How to create a guide that will predict the angle of a shot
by zackl · in Torque Game Builder · 10/28/2011 (5:34 pm) · 5 replies
I was wondering if anyone could point me in the direction on how to create a visible guide that will show the player the angle a shot will hit. Like in pool games where the player has a visible guide that will tell them the angle they will hit and the direction they will travel after the hit. I don't know where I should be looking for the solution(castCollision,polarForce) any help would be greatly appreciated. Thanks
#2
10/30/2011 (11:17 pm)
Hey William thanks for the reply. So there is no why to accomplish this with torquescrpt? I mean tgb has physics it also has math and vector math functions.What about using a invisible proxy object that is sent out until it collides with something and then figuring out the bounce formula...I always thought that a bounce an object took was opposite to to the angle of impact. I appreciate your time on this and any insights you have. thank you
#3
It is true that if you are doing something simple like sphere-to-sphere or sphere-to-line, you have simple calculations available to you. If you search "circle-to-circle collision" or "circle-to-line collision", you'll find resources that give you the point of impact, and the angle of incidence and reflection. You can then use those to draw lines in T2D.
11/02/2011 (1:35 pm)
Projecting an object out without having it interact with the existing game would likely require a modification to the C++ engine.It is true that if you are doing something simple like sphere-to-sphere or sphere-to-line, you have simple calculations available to you. If you search "circle-to-circle collision" or "circle-to-line collision", you'll find resources that give you the point of impact, and the angle of incidence and reflection. You can then use those to draw lines in T2D.
#4
thanks
11/02/2011 (7:05 pm)
hey William i appreciate your help. I am new at this but, I think that the way I have it set up with a circle set to bounce collision and that is colliding with a static side would be "circle to line" you mentioned.Does the "need to be straight"? Thanks for the reference to the resources I will definately check those out.thanks
#5
11/03/2011 (12:44 pm)
As long as your game doesn't have external forces (gravity, drag, other moving objects), finding where a moving circle hits a straight line should be all that you need.
Associate William Lee Sims
Machine Code Games