# playMaker

### Author Topic: Projectile Curve (Facing direction)  (Read 1527 times)

#### centaurianmudpig

• Playmaker Newbie
• Posts: 10
##### Projectile Curve (Facing direction)
« on: March 25, 2016, 04:44:18 AM »
Hey guys,

I'm trying to figure out how to make a projectile face the direction it is moving in.  I'm using the physics engine for movement and trying to simulate an arcing rotation based on the X and Y velocities of the projectile.

Here is what I tried, though it just starts rotating the projectile on all axis rather than the z axis I had hoped it would have calculated just using the X and Y velocities.

Thanks.

#### mdotstrange

• Hero Member
• Posts: 551
##### Re: Projectile Curve (Facing direction)
« Reply #1 on: March 25, 2016, 05:13:49 AM »
I had to do something similar recently and this worked for me
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

#### centaurianmudpig

• Playmaker Newbie
• Posts: 10
##### Re: Projectile Curve (Facing direction)
« Reply #2 on: March 26, 2016, 03:13:18 AM »
Thanks for the reply.  This block seems to run until completion instead of running over time in tandem with the rest of the FSM.

Execution stays in my RotateAngel state. The FSM relies on it just being called for frame before moving on to the next state, which loops back to RotateAngel.

I tried the ITweenLookAt and that acts the same as SmoothLookAtDirection.  Is there a way to just update slightly per frame rather than interrupting the flow of the FSM?

#### mdotstrange

• Hero Member
• Posts: 551
##### Re: Projectile Curve (Facing direction)
« Reply #3 on: March 26, 2016, 01:32:56 PM »
If you are trying to get a physics object to always face its direction of movement- the actions in my screenshot will do that.
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

#### centaurianmudpig

• Playmaker Newbie
• Posts: 10
##### Re: Projectile Curve (Facing direction)
« Reply #4 on: March 29, 2016, 11:56:07 AM »
Yes it does   Like I said, putting in that block stops the flow of execution of the FSM.  It just hangs inside the node I added the actions to for just that FSM forever.

Do you know why?

Here is an example.  First part shows the functionality of mouse clicking, and again with the rotate action enabled.
« Last Edit: March 29, 2016, 11:57:57 AM by centaurianmudpig »

#### mdotstrange

• Hero Member
• Posts: 551
##### Re: Projectile Curve (Facing direction)
« Reply #5 on: March 29, 2016, 02:08:21 PM »
So what you need to do is add those two states to a new FSM on the same object- its job is to steer the object in the correct direction- so add those states to a new FSM on the object-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

#### jeanfabre

• Hero Member
• Posts: 14244
• Official Playmaker Support
##### Re: Projectile Curve (Facing direction)
« Reply #6 on: March 29, 2016, 10:38:04 PM »
Hi,

MdotStrange is right, you need to create a specific Fsm for this, it's ok, it's how it works with Fsm. Since there can be only on active state at a time, it's a good practice to have a dedicated FSm for things that run constantly within one state only.

Bye,

Jean

#### centaurianmudpig

• Playmaker Newbie
• Posts: 10
##### Re: Projectile Curve (Facing direction)
« Reply #7 on: March 30, 2016, 03:53:53 AM »
Thanks. I'll try it out.