Need help with physics

Started by
1 comment, last by xoxos 8 years, 9 months ago

I'm using Unity to develop a game. Basically i want the player/rocket to follow a point on the screen where user touches. But It's based on physics. Force must be added when user touches somewhere and the rocket has to reach that point. Gravity is there too. If the rocket passes the point then it has to come by using forces. This is the game
http://www.flashyland.com/219-jeux-flash-vol-Space-Oil.html

The rocket rotates too. I'm not good in physics at all.


Advertisement

So what kind of calculation are you using for the rocket force currently? Is it something like this?


rocket.applyForce(worldSpaceTouchPosition - rocket.position)

i'm not real friendly with pointing my browser into the world so i can't tell what type of game you have, 2d 3d whatever.

so here's a copy/paste dump that may be helpful? tongue.png

i imagine that eg. gravity is a cumulative effect... if your target is 15 "steps" away, then the gravity will be incurred 15 times.

The gain of a recursive system at recursion n is derivable using the pow function:

gain_at_n_recursions = pow(gain, n);

Eg. a variable multiplied by 0.5 on every sample is obviously 0.0625 of its original value on the 4th iteration:
0.0625 = pow(0.5, 4);

If we intend to have a specific gain at a specific number of recursions, we can calculate a gain coefficient:

sought coefficient = pow(intended_gain_at_n_recursions, inverse_of_n);

eg: 0.5 = pow(0.0625, 1/4);

Given any two of these variables we can derive the third using the identities:
x = pow(b, y);
b = pow(x, 1 / y);
y = log(x) / log(b);

eg. 4 = log(0.0625) / log(0.5);

if you have a 3d system then the camera-through-mouse line can be calculated, the nearest target to that line selected (what the player is aiming at) and the distance to that object is used as the range to calculate ballistics.

(from my audio dsp notes, http://www.xoxos.net/sem/dsp2public.pdf )

neither a follower nor a leader behttp://www.xoxos.net

This topic is closed to new replies.

Advertisement