#How would I lock an Axis of an Character Controller?

1 messages · Page 1 of 1 (latest)

soft kayak
#

Hey guys. Im working on some kind of 3D Endless Runner (inspired by Race the Sun). I've build a system where i move the whole world around the player and not the player himself (exept for the y Axis, things like jumping and stuff). Now I switched from a Rigidbody to a Character Controller since I don't want to use unity physics anyway and the slope movement thingy is very useful for the things I'm trying to achieve.
The only thing that bug's me is that i cant lock the x and z position like I would with an rb. Sometimes when my player touches some Obstacles he gets pushed around. I tried working around that by always moving him back to 0,0,0 but tbh, I'm not very proud of this solution and it feels really wonky.
Does anyone have an idea of how I could lock my player or knows of a way to 'fake' something like that?
Any help is appreciated, thanks in advance :>

steep stratus
#

Character Controller API is a little limited, but zeroing out the axis should be fine unless it's messing with some of your physics solutions then I would suggest trying out Kinematic Character Controller on the asset store (is free)

verbal path
#

As an option: attach RigidBody component to the object but only use it to constraint movement, don't use it for anything else.

#

But yeah it appears there's no way to do it like RigidBody is doing it:

#

It's done with extern public RigidbodyConstraints constraints { get; set; } and it's a C++ binding