playMaker

Author Topic: Get angle issue [SOLVED]  (Read 2300 times)

MIKMANNER

  • Playmaker Newbie
  • *
  • Posts: 10
Get angle issue [SOLVED]
« on: March 01, 2012, 06:51:49 AM »
Hello - I have a problem, in my 2D scene facing the 'back' perspective, I have two physics objects in a scene, one is a ship and another is a ball. When the ship collides with the ball, the ball sets its position every frame to align in front of the ship. The ball also rotates in the direction of the ship, so both objects are 'looking' in the same direction.

My problem comes when I want to 'shoot' the ball in the direction which the ship is facing. In the add force action, I don't know how to do this, I have add impulse 200 on X  and the vector is the ship rotation but the ball seems to fly off in the wrong direction sometimes it will be correct and shoot ahead of the ship but other times it will just fly off in a completely different direction to what was intended.

If anyone can lend a hand it would be very much appreciated. :)

Thanks
« Last Edit: March 05, 2012, 01:45:55 PM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Get angle issue
« Reply #1 on: March 02, 2012, 04:39:37 PM »
Do the ship and ball both have rigid bodies? Perhaps they are too close together and collide creating the occasional wild shot?

It's hard to say without looking at it...

MIKMANNER

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Get angle issue
« Reply #2 on: March 05, 2012, 09:26:59 AM »
Thanks man I worked it out - is fine now :)