Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: agito1987 on September 19, 2016, 12:29:30 PM

Title: Smooth look at direction - Crashing enemy aircraft
Post by: agito1987 on September 19, 2016, 12:29:30 PM
Hey
(My game is in 2.5D)
When I shoot down an enemy air unit I want it to crash in a ark so it can potentially hit other enemys while it is falling to the ground.
Right now I tried to accomplish this by spawning a damaged prefab of the original. There is only 1 fsm attached to the object with 1 state.
“Translate” (so it moves forward).
“Smooth look at direction” (so the mesh gradually goes into the nose dive and I have an ark shape movement.)

The object does what it is supposed to do, the object rotates to the ground in an ark shape.
However. Because I work in 2.5 D the ship must only rotate in the X axes. But in my case the ship incorporates a rotation in the X axes. Because of this the object drifts to the side and misses all my other object in the scene.

So my question how can I limit the rotation in the X axis, or is there a better way than “translate” & “Smooth look at direction” to let my prefab nose dive?
Title: Re: Smooth look at direction - Crashing enemy aircraft
Post by: djaydino on September 19, 2016, 08:26:33 PM
Hi.
Have yo tried "smooth look at 2d" ?

When needed you can replace the rigidbody and collider component with rigidbody2D and Collider 2D
Title: Re: Smooth look at direction - Crashing enemy aircraft
Post by: agito1987 on September 20, 2016, 08:52:04 AM
Hi.
Have yo tried "smooth look at 2d" ?

When needed you can replace the rigidbody and collider component with rigidbody2D and Collider 2D

Using Look at 2D only turns to the side and moves into the horizon. =/
This works out worse for me. But I don’t even understand why the object goes of tot he side. My Y is up and set target position to – 1 Y. Even if i use a game object as the target position it still floats away to the side.
Tried all sort of setups but can’t seem to figure this one out
Title: Re: Smooth look at direction - Crashing enemy aircraft
Post by: djaydino on September 20, 2016, 02:07:57 PM
Hi,
Maybe you can use the constrains in the rigidbody component?
Title: Re: Smooth look at direction - Crashing enemy aircraft
Post by: agito1987 on September 21, 2016, 05:51:40 AM
No that doesen't work.
Because i move the object with translate, and rotate with look at the constraints have no effect at all. Think I will look into other solutions than what I am doing now.

If I get it fixed I will post my solution here :).