View Single Post
Hyper Nova
BANNED
Join Date: May 2012
Old 07-09-2012 , 20:40   Re: Module: BMOD - Extended Physics Module
Reply With Quote #95

Quote:
Originally Posted by yokomo View Post
Hi,
Sorry, but how to make a ball that can be collides with players? i want to use this module in soccerjam.
you can make this by plugin.
Make new entity and make it a bmod and register touch.
If player touch then get player speed and origin and bmod entity origin and speed.
code:

PHP Code:
Float a[3] = player speed
Float b
[3] = player origin

Float c
[3] = bmod speed
Float d
[3] = bmod origin
new Float:e[3], Float:f[3], Float:h[3], Float:h2[3]

e[0] = a[0] + c[0]
e[1] = a[1] + c[1]
e[2] = a[2] + c[2]
f[0] = b[0] - d[0]
f[1] = b[1] - d[1]
f[2] = b[2] - d[2]
h2[0] = (e[0] + f[1]) * 0.75
h2
[1] = (e[1] + f[0]) * 0.75
h2
[2] = (e[2] + (f[2] - ( f[2] * 2.0 ))) * 0.75
// set_bmod_ent_rotate_speed (h2)

h[0] = (e[0] + f[0]) * 0.75
h
[1] = (e[1] + f[1]) * 0.75
h
[2] = (e[2] + f[2]) * 0.75
// set_bmod_ent_speed(h)

// 0.9 will be the bmod entity mass
a[0] *= 0.9
a
[1] *= 0.9
a
[2] *= 0.9
// set_player_speed(a) 
It is now perfect but i hope it help you somehow.
Hyper Nova is offline