About Store Forum Documentation Contact



Post Reply 
Helicopter
Author Message
Harry Offline
Member

Post: #1
Helicopter
Hello,

I'm going to make helicopter in my game which will fly around the player.

In actual stage to move helicopter to some position I use Lerp :

pos(Lerp(pos(),newPos,time));

and it works ok, but I want to get velocity of helicopter and actor.vel doesn't work. I found on community that the bast way is to use actor.addForce or similar, but I'm not sure how do this. Helicopter always flies far away. My helicopter class base on Game::Item. Could you give me some advices?
07-24-2011 02:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Helicopter
vel = delta_pos / delta_time
if you're setting pos manually, you can also manually calculate the vel.
07-27-2011 12:41 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Helicopter
Ah ok, I didn't thought about it in that way. I'll try it, thanks.
07-27-2011 12:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #4
RE: Helicopter
Now I have a small question about Lerp* functions. I'm not sure how to set step variable properly. I want to show you some graphs.

[Image: beztytuusz.png]

First two graphs show how Lerp function seems to work (step is set as Time.d()/3) and how looks then velocity of helicopter. It has in the first second max velocity and it's drops until helicopter reaches new position.

But I'd like to get something like on next two graphs. The helicopter will slowly gets faster and then when it will be near it's target his velocity will slowly drop. How can I get it?
07-30-2011 08:32 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #5
RE: Helicopter
Step is typically a value between 0 and 1, which determines where the output is between the two values. (e.g. its the position along the x axis, then you read the respective value on the y axis for the output of the function).

In Math.h you get different interpolation types such as Cubic, see LerpCube, etc. Visualise these in Tools/Functions.exe: e.g. LerpSmoothPow(0,1,x,0.5)

Also you can refer to, http://www.iquilezles.org/www/articles/f...ctions.htm and write your own function if you need more control
07-31-2011 10:46 AM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #6
RE: Helicopter
Wow thanks, I didnt know that I can visualise Lerp in Functions. It really help me so I try with some values and maybe I'll get what I'm looking for. Thanks smile
07-31-2011 12:12 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply