I have been working on making a skate-like object that will move forward quickly (no friction: y axis) but sideways slowly (lots of friction: x axis). I made a skate material and applied it to the skates, but I dont think there is any effect to the character object if it is going downhill sideways or forward. Oh, the surface has an Ice Material and the object uses a basic controller that doesn’t include physics (but it doesnt use the character controller).
Do I need to activate the physic materials through the controller script, or is there something else that I forgot to apply to make the physic materials interact with their surroundings.
If it requires scripting in the controller, could someone be kind enough to show a small example of how this would be done?
Thanks.
It might be the character thing that prevents it from working. Try to put a box or aphere with a rigid body and use your materials. If that works, the problem is the character scripts (have never looked at them so i dont know what they do). Unfortunately, using physical materials is not perfectly stable. Hopefully enough for your application but for vehicle tires, it’s not good enough. What I did was adding lateral forces by myself in fixedupdate. Good luck!
Thanks for the reply, but I think I got it working again. I had to re-import the model and apply things from new, but then it worked!
it seems you got it fixed, but I’d like to add my two cents, as I came across a similar problem (but for an object moving in multiple dimensions). I basically interpolate drag by myself, by finding out the objects velocity in local space, rather than world space.
function InterpolateDrag () {
var localVelocity : Vector3 = transform.InverseTransformDirection(body.velocity);
if (localVelocity.y <0){
localVelocity.y = localVelocity.y/(1.05);
}
//now translate local velocity bleeds back to actual space.
body.velocity = transform.TransformDirection(localVelocity);
//pseudodrag. make sure we can't go over 100 m/s in x and z directions.
body.velocity.x = body.velocity.x/(1.015);
//speed of sound friction
if (body.velocity.x < -200 || body.velocity.x > 200){
body.velocity.y = body.velocity.y/(1.010);
//Debug.Log(body.velocity.y);
}
body.velocity.z = body.velocity.z/(1.015);
//speed of sound friction
if (body.velocity.z < -200 || body.velocity.z > 200){
body.velocity.y = body.velocity.y/(1.010);
//Debug.Log(body.velocity.y);
}
//prevent from flying upwards (but not down!) at ludicrous speeds.
if (body.velocity.y > 0){
body.velocity.y = body.velocity.y/(1.015);
}
//speed of sound friction
if (body.velocity.y < -200 || body.velocity.y > 200){
body.velocity.y = body.velocity.y/(1.010);
//Debug.Log(body.velocity.y);
}
}