Motorised grabber strength and sound for collisions

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
ole_92
Posts: 35
Joined: Fri Apr 06, 2012 12:08 pm

Motorised grabber strength and sound for collisions

Post by ole_92 »

Hi Norbo,

Could you please answer these questions if you have a minute:

1) How can I alter the "power" of a grabber? It feels like all the objects I'm holding are hanging on an invisible gum string :) I need them to move to where the camera is pointing faster.

2) I'm thinking about adding different sounds for collisions, but I don't know how to access that. Is there a "OnCollision" method or something?

Thanks very much
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Motorised grabber strength and sound for collisions

Post by Norbo »

1) How can I alter the "power" of a grabber? It feels like all the objects I'm holding are hanging on an invisible gum string I need them to move to where the camera is pointing faster.
The grabber is based on motors, and those motors have configurable spring settings. Multiplying the linearMotor.Settings.Servo.SpringSettings.DampingConstant and linearMotor.Settings.Servo.SpringSettings.Stiffness by the same factor will increase (or decrease) the strength of the spring.

The linearMotor.Settings.Servo.BaseCorrectiveSpeed can also be set to introduce a constant base target velocity. This is added to the corrective velocity resulting from the spring settings.

Note that if the mass of an object is higher, the motor must be proportionally stronger to have the same effect. Trying to pull a thousand-ton boulder requires a much stronger spring, as expected. But, you may not want to let a player pick up a thousand-ton boulder :)
2) I'm thinking about adding different sounds for collisions, but I don't know how to access that. Is there a "OnCollision" method or something?
Yup. However, it may be more convenient to scan the entity.CollisionInformation.Pairs list, checking the Contacts list of each pair, and checking the NormalImpulse/FrictionImpulse/RelativeVelocity associated with each Contact. This 'query' version is usually better suited to multi-frame sound management.
Post Reply