Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: colpolstudios on June 17, 2014, 04:51:52 PM

Title: help needed rotating a bullet to match the players direction[SOLVED]
Post by: colpolstudios on June 17, 2014, 04:51:52 PM
Hi I have been reworking the main character of the stealth tutorial, playable demo of my progress so far:

https://dl.dropboxusercontent.com/u/150707256/playmaker%20stealth%20new%20character%20WIP/testing%20only.html

The character model never rotates but uses animation to do so, so when I create the bullet i need some way to rotate the bullet so that it its z direction matches the animated direction of the player.

I translate the bullet in its current z axis.

In the demo the translation is OFF!

Any ideas are most welcome as I am beaten so far.
Title: Re: help needed rotating a bullet to match the players direction
Post by: redikann on June 17, 2014, 06:41:59 PM
Have you tried dragging the transform of the animated mesh onto a fsm action panel of the bullet. You should be able to get/set properties pertaining to Transform like vector Forward.
Title: Re: help needed rotating a bullet to match the players direction
Post by: Alex Chouls on June 17, 2014, 09:07:09 PM
There are also Get Rotation and Set Rotation actions that are a little easier to work with... Basically get the rotation of the player then use that to set the rotation of the bullet. If you need to override individual axis, e.g., zero out rotation around one axis, you can use Set Vector3 XYZ.
Title: Re: help needed rotating a bullet to match the players direction
Post by: colpolstudios on June 18, 2014, 04:59:14 PM
I am still having trouble.

In the Player rotation fsm state Turn. I added "Set FSM Quaternion"

choosing the prefab bullet created, the fsm name and variable used setting the value to the "new rotation"

The prefab value changes correctly, but the transform of the bullet needs to change so that the bullet changes his transform direction to match the rotation.

I can translate in the new rotated z direction I think??

I require more help with this sorry




Title: Re: help needed rotating a bullet to match the players direction
Post by: redikann on June 18, 2014, 06:02:34 PM
Pictures would be great. Remember that Forward Z is a local vector so if you want your  local transform to align to your rotation then make sure your applied rotation is also happening with the local flag.
Title: Re: help needed rotating a bullet to match the players direction
Post by: colpolstudios on June 18, 2014, 06:52:52 PM
Sorry no pictures my internet is very poor at present :(

What local flag do you mean?

I cant take a Quaternion rotation and use this in a vector 3.

Possibly I am missing more than just this?

Sorry but im lost
Title: Re: help needed rotating a bullet to match the players direction
Post by: redikann on June 18, 2014, 07:09:10 PM
In your rotate action you can set the Space to World(Global) or self(Local)
Title: Re: help needed rotating a bullet to match the players direction
Post by: colpolstudios on June 20, 2014, 10:03:06 AM
Thanks redikann everything is working now:)