playMaker

Author Topic: help needed rotating a bullet to match the players direction[SOLVED]  (Read 2804 times)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
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.
« Last Edit: June 20, 2014, 10:03:52 AM by colpolstudios »

redikann

  • Full Member
  • ***
  • Posts: 174
Re: help needed rotating a bullet to match the players direction
« Reply #1 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.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: help needed rotating a bullet to match the players direction
« Reply #2 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.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: help needed rotating a bullet to match the players direction
« Reply #3 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





redikann

  • Full Member
  • ***
  • Posts: 174
Re: help needed rotating a bullet to match the players direction
« Reply #4 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.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: help needed rotating a bullet to match the players direction
« Reply #5 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

redikann

  • Full Member
  • ***
  • Posts: 174
Re: help needed rotating a bullet to match the players direction
« Reply #6 on: June 18, 2014, 07:09:10 PM »
In your rotate action you can set the Space to World(Global) or self(Local)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: help needed rotating a bullet to match the players direction
« Reply #7 on: June 20, 2014, 10:03:06 AM »
Thanks redikann everything is working now:)