Forum rules - please read before posting.

Player Controller Locks Rotation in the Z-Axis

I am trying to use the Player controller of Adventure Creator for a game which will feature Gravity puzzles. I want the player to be able to interact with the world in a First Person environment, but because gravity will be variable they may start doing things like walking on walls / ceilings, falling in different directions (I might also have zero-g movement).

I wrote a system that can detect the appropriate "down" and rotate a Rigidbody to match gravity, so they are always walking appropriately (this could be up a wall or even on a large sphere).

The issue is whenever I try to alter the character's orientation, AC's Player script (I think the logic is actually in the "Char" class, but I am not positive) keeps rotating the object's up vector back to Vector.up.

Another issue I am having is the limiting of the direction of rotation, since you can input a min/max angle that the camera will rotate, this is calculated by Vector3.up instead of the active GameObject.transform.up.

I realize that this logic is a very "me" problem, so I don't really need a "fix" where AC can handle this, but I want to know what logic do I need to remove to get this working, even if I need to provide my own Rigidbody controller to handle character movement.

Lastly, I tried setting Motion control to Manual, but that didn't resolve the issue, it still tried to change the rotation back.

Thank you

Comments

  • Welcome to the community, @Protesilaus.

    Normally, setting the Motion control to Manual should be enough to completely detach AC from affecting the position/rotation of the character.

    The exception to this, however, is in the case of First Person movement - as this require the rotation to be set explicitly for it to work.

    If yours is a first-person game, and you want to go down the custom motion controller route - which I'd recommend for gameplay that involves an arbitrary gravity direction - you'll also need to set your Movement method to None.

    This will ensure that AC has no direct control over the character's Transform - allowing you to instead control them through script.

    There are dedicated assets out there that allow for arbitrary gravity directions. KCC is my personal pick, and a sample integration script for it can be found on the AC wiki.

    That said, you do raise a good point about AC's use of Vector3.up - and it would be sensible to merge all calls to it for a given character to a single property, so that it can be overridden through custom means. I shall look into this as part of the next update.

  • I've been looking into this.

    There's a fair bit more to it than simply changing references to Vector3.up, but it looks feasible to change such than an arbitrary up direction can be fed into the character through scripting.

    While I'd still recommend a dedicated custom controller if you intend to have complex player movement, it should be possible to allow for e.g. basic wall walking in AC's player controller. I'll look into it as part of v1.79 - thanks for raising the issue.

  • No problem, I'll continue down the line of a Custom Motion Controller. I already have a working prototype (since I wasn't sure how long this was going to take, I spent time last couple days on it) with Character Movement Fundamentals which I probably got from a Humble Bundle awhile back. I have most of the functionality working with just that, but still need to look at re-integrating AC.

  • I set Interface settings->Movement method to None which fixed some issues with the camera, but if I try to rotate the Player it still gets reset to 0. I'll have to debug later to see if I can find out where this is happening.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.