playMaker

Author Topic: decreasing speed of player without 2d wheels  (Read 4946 times)

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
decreasing speed of player without 2d wheels
« on: June 23, 2014, 09:08:38 PM »
I have a object that the player controls where it doesn't rely on a two wheel driving system. And in my game I want to set a object to trigger slowing down the players car.

How can I slow down the cars speed.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: decreasing speed of player without 2d wheels
« Reply #1 on: June 23, 2014, 11:59:59 PM »
How about Add Force in the opposite direction?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: decreasing speed of player without 2d wheels
« Reply #2 on: June 24, 2014, 01:42:20 AM »
How about Add Force in the opposite direction?

How would that work though? Because when I added that in a state, even with the other being connected with a trigger event, it falls off of the level.

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: decreasing speed of player without 2d wheels
« Reply #3 on: June 25, 2014, 06:20:28 PM »
How about a button that increases the drag on the rigid body and resets it when you let go?
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: decreasing speed of player without 2d wheels
« Reply #4 on: June 25, 2014, 10:26:25 PM »
How about a button that increases the drag on the rigid body and resets it when you let go?

What would that mean in terms of setting up the correct action for that state? Cause I'm trying to simulate mud.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: decreasing speed of player without 2d wheels
« Reply #5 on: June 26, 2014, 01:13:39 AM »
You should be able to make a Physics Material to simulate mud, apply that to the surface and let the physics simulation handle the slowdown:
http://docs.unity3d.com/Manual/class-PhysicMaterial.html

No actions needed, just physics tweaking...

Unless you have to cheat and manipulate the drag (or other physics properties) as sebaslive suggests. There is a Set Drag action you could use, and a Set Property action to set other Rigidbody properties (there are videos on our YouTube channel showing how to use Get/Set Property).

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: decreasing speed of player without 2d wheels
« Reply #6 on: June 29, 2014, 09:12:12 PM »
When I add a rigidbody to the player with the standard movement scripts I get a error message.

Code: [Select]
Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes!Please Change mesh geometry or supply a tensor manually!

And for the player, I tried both quad and cube.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: decreasing speed of player without 2d wheels
« Reply #7 on: June 29, 2014, 09:18:57 PM »
Are you using a Mesh Collider?

A quick search about this error:
http://answers.unity3d.com/questions/386168/updatemassfromshapes-error.html

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: decreasing speed of player without 2d wheels
« Reply #8 on: June 29, 2014, 09:31:06 PM »
Are you using a Mesh Collider?

Yes I am. I did remove it and got the same message. Do you think if has to do with actions simple move and controller settings?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: decreasing speed of player without 2d wheels
« Reply #9 on: June 29, 2014, 11:48:52 PM »
Did you replace it with a primitive collider? I don't think it has anything to do with the actions since it happens with regular scripts too... I think it's more of a physics setup issue (with an unhelpful error message!).

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: decreasing speed of player without 2d wheels
« Reply #10 on: June 30, 2014, 01:22:14 AM »
Did you replace it with a primitive collider?

No. What would that be? A box collider?
« Last Edit: June 30, 2014, 01:28:37 AM by coffeeANDsoda »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: decreasing speed of player without 2d wheels
« Reply #11 on: June 30, 2014, 01:35:03 AM »
Whichever primitive collider best matches the shape of the player (box, sphere, capsule)

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: decreasing speed of player without 2d wheels
« Reply #12 on: June 30, 2014, 01:52:34 AM »
Whichever primitive collider best matches the shape of the player (box, sphere, capsule)

Since it is the length of a car I used one and the this happens after the game pauses.

Code: [Select]
Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes! Please change mesh geometry or supply a tensor manually!
UnityEngine.CharacterController:SimpleMove(Vector3)
HutongGames.PlayMaker.Actions.ControllerSimpleMove:OnUpdate() (at Assets/PlayMaker/Actions/ControllerSimpleMove.cs:52)
HutongGames.PlayMaker.FsmState:OnUpdate()
HutongGames.PlayMaker.Fsm:UpdateState(FsmState)
HutongGames.PlayMaker.Fsm:Update()
PlayMakerFSM:Update()

and
Code: [Select]
Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes! Please change mesh geometry or supply a tensor manually!
UnityEngine.CharacterController:Move(Vector3)
CharacterMotor:UpdateFunction() (at Assets/Standard Assets/Character Controllers/Sources/Scripts/CharacterMotor.js:229)
CharacterMotor:FixedUpdate() (at Assets/Standard Assets/Character Controllers/Sources/Scripts/CharacterMotor.js:331)

What should I do when dealing with rigidbody settings? Cause you have collision detection settings, interpolate and everything else.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: decreasing speed of player without 2d wheels
« Reply #13 on: June 30, 2014, 02:24:02 AM »
Do you have a mesh collider on one of the children?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: decreasing speed of player without 2d wheels
« Reply #14 on: June 30, 2014, 02:48:26 AM »
Do you have a mesh collider on one of the children?

I have it set up so the drivers is inside of or part of the vehicle. I forgot to remove the mesh collider on the driver. So when I removed it and applied a box collider and rigidbody to the car the whole thing goes up in the air, settles, and then the camera freaks out.

Would I have to freeze the position in order to not make it do that?
« Last Edit: June 30, 2014, 02:51:54 AM by coffeeANDsoda »