Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - OleP

Pages: [1]
iOS Help / Add velocity to object based on drag velocity
« on: February 15, 2012, 05:58:20 AM »
Hi there.
I've made a FSM to drag and drop a gameobject on a plane(based on the MouseClickToDrag sample). But when I release the gameobject, I want to add velocity to it, based on the velocity it had on the point of release. The goal is to make the gameobject behave like an ice puck, and bounce around inside a 2D frame.

 I currently got 5 states:
Wait for click -> Clicked world? -> clicked object? -> drag object -> add velocity

On the "drag object" state, I've added a "Get Velocity" action, and stored it into a vector3 variable. On the "add velocity" state, I've added a "Add Velocity" action, and chosen the vector3 variable as source.

And here comes the problem: How do I measure the velocity the gameobject has on the point of release? I'm using "Mouse Pick" and "Set position", but when I drag it around, it dosen't measure any velocity.

I hope I've explained it well enough for you guys to understand. If not, I can post the whole project for you.
If you know another way to do this, feel free to post the suggestion.

Pages: [1]