Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,405 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | chip programmers | 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