levitateMotor isn't colliding properly

Discuss coding questions, pull requests, and implementation details.
User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

levitateMotor isn't colliding properly

Post by MeteoricDragon »

I noticed in the comments in the code that levitateMotor isn't' colliding properly. I have been testing this and I'm confused how it's not working.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: levitateMotor isn't colliding properly

Post by Interkarma »

This is a known limitation of how Unity's Character Controller handles physics. For example, levitating over a moving elevator will cause elevator to pass through player's body.

There's no good general fix for this at this time, but fortunately it's only a problem under certain conditions and doesn't have any major impact on play.

It's definitely something I'd like to address before 1.0, but not worried about it at the moment.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: levitateMotor isn't colliding properly

Post by MeteoricDragon »

Interkarma wrote: Sat Aug 25, 2018 2:34 am This is a known limitation of how Unity's Character Controller handles physics. For example, levitating over a moving elevator will cause elevator to pass through player's body.

There's no good general fix for this at this time, but fortunately it's only a problem under certain conditions and doesn't have any major impact on play.

It's definitely something I'd like to address before 1.0, but not worried about it at the moment.
The way I was noticing this issue in gameplay is when I was trying to get the player to climb out of water. I wrote some code that successfully used a raycast to get the player to climb a little bit, but he can't make it out of the water. I see what you mean about no good way to code around it.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: levitateMotor isn't colliding properly

Post by Interkarma »

Hmm, not sure. If you're able to at least start the climbing process, maybe levitate motor can shut itself down while player is "attached" to surface they are climbing. Then if the player falls or releases climbing, levitate motor will run again.

Maybe just adding a playerClimbing check at the top PlayerLevitate.Update() to return when climbing will do it? Might not work, just something to try and possibly get rolling towards a better solution.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: levitateMotor isn't colliding properly

Post by MeteoricDragon »

@interkarma you would be interested to read the solution to this forum post I made in another forum that I just got a response in. :) https://forum.unity.com/threads/charact ... gs.546834/

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: levitateMotor isn't colliding properly

Post by Interkarma »

That is interesting! I'd agree with him it was probably something renamed between versions. Good work chasing that down! :)

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: levitateMotor isn't colliding properly

Post by MeteoricDragon »

I've made some good progress on getting it to work. Now it starts climbing and jerks me back into the water. Will need to play with it some more tomorrow.

I found out the reason it wasn't climbing in the first place is that the LevitateMotor makes multiple calls to the CharacterController.move function and each call overwrites the CollisionFlags with whatever newer call collided with. I rewrote the parts that make individual calls to the CharacterController.Move function for each individual axis direction and that crouch/up down vector I made the Y component choose whichever was the fastest Y input given, the WASD direction, or the CrouchJump constant speed.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: levitateMotor isn't colliding properly

Post by Interkarma »

Thanks for all your work on this. You've made awesome progress on player movement throughout this whole version cycle.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: levitateMotor isn't colliding properly

Post by MeteoricDragon »

Thanks! I have an update for you. Before I can program the player to climb onto platforms out of water, The climbing system needs to be fixed. It's accidentally working as it stands.

If I comment out the skill check in the ClimbMovement method, the player will continue climbing into the air and into the ceiling regardless of whether it's onto dry land from water, or dry land to dry land. The skill check failure is what allows the player to step onto the new platform, Lower climbing skill is essentially what causes the player to land on the new platform sooner. A high skill would make the player climb into the clouds along an invisible wall.

To fix this, there needs to be an actual check to run while climbing to see if the player would collide with the wall if he walks forward. So it can run repeatedly because the climbingMotor is setting the collisionFlag without checking the wall.

Also, the skill check system needs to be better used because when the skill check fails, the player just seems to slip a little bit.

User avatar
MeteoricDragon
Posts: 141
Joined: Mon Feb 12, 2018 8:23 pm

Re: levitateMotor isn't colliding properly

Post by MeteoricDragon »

Ok, I got a system to work that uses a short capsulecast the shape of the player aimed forward and it works great, except for the one spot i've been testing it at. I think there's bad geometry that prevents climbing out of water in some spots. I havent' tested it in any other water spots though. UPDATE: it has problems in more than just the pictured spot.
Attachments
This is a picture of the place i can't climb out of
This is a picture of the place i can't climb out of
can'tclimbOut.jpg (67.3 KiB) Viewed 2644 times

Post Reply