playMaker

Author Topic: Limit velocity of the ball[SOLVED]  (Read 2021 times)

Marakesch

  • Playmaker Newbie
  • *
  • Posts: 2
Limit velocity of the ball[SOLVED]
« on: March 26, 2016, 04:37:29 AM »
Good day everyone,
I have a ball, which one have acceleration by add force/impulse, when it touch platform. Problem is how to limit its velocity in any direction, when it reach some value. Thanks in advance
« Last Edit: March 29, 2016, 01:43:40 AM by jeanfabre »

centaurianmudpig

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Limit velocity of the ball
« Reply #1 on: March 26, 2016, 06:19:05 AM »
I think you should be able to do this by:
GetVelocity then clamp via Vector3ClampMagnitude and the SetVelocity.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Limit velocity of the ball
« Reply #2 on: March 28, 2016, 03:03:35 AM »
Hi,

 yes exactly.

I am currently porting the asteroid Unity network sample, and the ship has velocity clamping, and I use this technic, however just slightly different in the following sense:

 for effective physics control, actions should perform on "FixedUpdate", not a regular Updates, and so vector3ClampMagnitude isn't featuring the option to use FixedUpdate.

 so I use Vector3ClampMagnitudeAdvanced from the Ecosystem which allows for clamping during FixedUpdate which results in a better more reliable system.

Bye,

 Jean


Marakesch

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Limit velocity of the ball
« Reply #3 on: March 28, 2016, 01:07:05 PM »
Thanks for your replys, i will try do it. Before found solution by code, thanks anyway for your answers.