playMaker

Author Topic: Car movement  (Read 1746 times)

Ronnie gaikwad

  • Playmaker Newbie
  • *
  • Posts: 22
Car movement
« on: March 04, 2020, 02:58:18 PM »
How can i have the car movement like this? Currently I'm using get axis to move the car left and right and i can use vector 3 and smooth look at direction to make it look left and right.. But how to make the car come back to normal facing straight when there is no dragging of car like when there is no horizontal movement.. I want to know how can i move the car left and right with smooth looking at that direction and after that when there is no move the car automatically comes to neutal way with facing front. ref link.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Car movement
« Reply #1 on: March 05, 2020, 04:45:20 AM »
Hi.
On the Ecosystem is a Sample Called 'Simple Car' maybe that can help

Ronnie gaikwad

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Car movement
« Reply #2 on: March 05, 2020, 02:39:40 PM »
Sorry but this action only got brake and torque. I don't think it can help me in what I I'm looking for.. And if it does then how?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Car movement
« Reply #3 on: March 06, 2020, 12:48:49 AM »
Hi.
Sorry i never tried the sample myself, i just saw it on the Ecosystem.

from the sample movie i can see that camera is only moving left/right
depending on the position of the car.

the car it self i think is also just moving left/right but the animations make it look like its turning

so for mobile probably when you press left/right side of screen it will gradually set velocity to left/right and when released it will gradually set velocity to 0

and for the animation it will check the velocity to rotate animation to the correct direction

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Car movement
« Reply #4 on: March 10, 2020, 03:23:26 AM »
Hi,

 you need to use the action GetDeviceRoll.

 you get the angle. to turn this into an input, bring the angle back to a -1,1 range using the custom action FloatRemap on the ecosystem.

 you can then use this value as the input to control your vehicle steering, it would work with the vehicle sample on the ecosystem.

basically, in the simple car sample, you need to replace the get axis action with what I mentionned above



Bye,

 Jean

Ronnie gaikwad

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Car movement
« Reply #5 on: March 10, 2020, 02:56:29 PM »
Hi Jean thanks for your reply.
Do i need get device Roll and float remap in the same state?and do i have to use variable for store angle and limitangle? And then where to use those variables? Will this all give me the car movement that I'm looking for?
Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Car movement
« Reply #6 on: March 11, 2020, 02:25:12 AM »
Hi,

 you can do it all in one state, get the roll, remap, and use that remaped value as the input for turning. angle limit could be a variable, but not necessarly, however I would suggest you put that into a variable that you then expose to the inspector and then as you play the scene you can fine tune that value to get the desired result.

 sure, the game play is litteraly just that, using the device roll to turn the car on the road. what you will need to fiddle around with is the range and multiplication factor of the device roll angle to the turn input,

Bye,

 Jean

Ronnie gaikwad

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Car movement
« Reply #7 on: March 14, 2020, 05:23:28 AM »
Thanks jean.. Also how can i make the enemies stick to the car same as the above video and then unstick after the enemies collide with other cars? I can use get distance to move the enemies to the car when the car is close to enemy and can use the collision event for the enemy to collide with other car.. The main part is how to make them stick and then unstick after collision with other car.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Car movement
« Reply #8 on: March 15, 2020, 03:09:48 AM »
Hi.
In short, parent the enemies to the car, then on collision (trigger might be better)
un parent.

depending on your setup you might need to do things like 'set position' once hitting the driving car also if it uses velocity you might need to set it to 0.
possible also gravity need to be set to 0 etc.