Page 1 of 1

Motorised grabber strength and sound for collisions

Posted: Sat May 12, 2012 3:03 pm
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

Re: Motorised grabber strength and sound for collisions

Posted: Sat May 12, 2012 3:40 pm
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.