playMaker

Author Topic: SOLVED: move object forward to where it is facing.  (Read 2688 times)

cel

  • Full Member
  • ***
  • Posts: 132
SOLVED: move object forward to where it is facing.
« on: July 19, 2017, 04:18:34 PM »
Hey guys,

I have a ball that I rotate on the y axis with left and right keys( with the rotate action) and I want to use the up key to move in the direction it is facing, I am having trouble with the last part.

It is like a top down 360 movement, if someone could give me some help or even have a little example I would appreciate it.

Due to my incompetence a step by step guide would be better :) :)

Thanks for your help,

« Last Edit: July 20, 2017, 05:01:27 PM by cel »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Help: move object forward to where it is facing.
« Reply #1 on: July 19, 2017, 09:24:51 PM »
Hi,
So when you only rotate on the y axis the ball should not move, right?

Then you might want to use a Parent to do the movement on.
Copy your ball then set one as child on the other.

Use the child for the rotation and set Is Kinematic on.
Also disable or remove the Collider on the child.

On the parent disable your mesh renderer (make you parent ball invisible)
and use for movement.

But if you want a real rolling ball effect you can check the roll a ball sample on the ecosystem.
(if you cant get it on the ecosystem you can get it here)

cel

  • Full Member
  • ***
  • Posts: 132
Re: Help: move object forward to where it is facing.
« Reply #2 on: July 20, 2017, 06:12:26 AM »
can't get it to work, I've attached the project I have so far(@admin - I removed the playmaker dlls, is that enough to post here?, if not feel free to remove)

So it rotates like I want it to, but going forward it doesn't go to where its pointing, please have a look....

dropbox link - https://www.dropbox.com/s/obkkrwe1p9hsblg/balltest.unitypackage?dl=0

Thank you in advance

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Help: move object forward to where it is facing.
« Reply #3 on: July 20, 2017, 09:34:07 AM »
Hi,

 This is very hard to achieve with pure logic, so i would not consider going this way, and use Physics and a rigid body for your ball, which you can then control with forces which will be independent from the ball rotation itself ( it will be either from the screen reference or camera reference).

 Have you experimented with this already?

Bye,

 Jean

cel

  • Full Member
  • ***
  • Posts: 132
SOLVED: move object forward to where it is facing.
« Reply #4 on: July 20, 2017, 05:00:26 PM »
your advice seems to work just fine jean, (suppose I have to live with the physics of it)

thank you both Jean and djaydino