Jump to content
  • Advertisement
Sign in to follow this  

Unity Need help with physics

This topic is 1244 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

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


Edited by AntiSaby

Share this post

Link to post
Share on other sites

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

rocket.applyForce(worldSpaceTouchPosition - rocket.position)

Share this post

Link to post
Share on other sites

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 )

Edited by xoxos

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!