Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,619 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bounce for c_trace #267132
05/22/09 04:41
05/22/09 04:41
Joined: Oct 2006
Posts: 175
G
Gumby22don Offline OP
Member
Gumby22don  Offline OP
Member
G

Joined: Oct 2006
Posts: 175
Hi,

Could someone help me setting up a manual bounce calculation - only just realised the bounce isn't set by c_trace, only by c_move. normal is still set, and the following is my guess at how bounce is calculated, but my head hurts so I can't think :P

note tempGun is the speed of the fired weapon. so "speed" in the manual's decription.
Code:
//bounce = speed + 2*dot(normal,-speed)*normal, while speed = distance vector to target, normal = target surface normal. 
vec_set(tempV1, tempGun);
vec_scale(tempV1, -1);
tempV2 = vec_dot(normal, tempV1);
vec_set(tempBounce, normal);
vec_scale(tempBounce, tempV2 * 2);  //new Bounce


Is this even remotely close to correct?

Thanks,

Don
have a great day


Last edited by Gumby22don; 05/22/09 04:42.
Re: bounce for c_trace [Re: Gumby22don] #267343
05/23/09 11:36
05/23/09 11:36
Joined: Oct 2006
Posts: 175
G
Gumby22don Offline OP
Member
Gumby22don  Offline OP
Member
G

Joined: Oct 2006
Posts: 175
Ok - figured it out in about 5 mins with coffee...

I didn't add the original speed vector to it, - real code now looks like this:
Code:
vec_set(tempV1, tempGun);
vec_scale(tempV1, -1);
tempV2 = vec_dot(normal, tempV1);
vec_set(tempBounce, normal);
vec_scale(tempBounce, tempV2 * 2);  
vec_scale(tempV1, -1);	//back to speed
vec_add(tempBounce, tempV1); //add speed to 2*dot*normal.  //new Bounce


Hope this helps someone.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1