#Character Controller with a Physics Shadow

1 messages · Page 1 of 1 (latest)

placid lynx
#

Why don't you just write some code in your CharacterBody3D to make it pushable?

#

@

hidden wyvern
#

Also, I don't want the character body to just be pushable, I want it to also interact with other rigid bodies too, like push them and what not.

placid lynx
#

Why don't you just check if a node is a rigid body and apply your character's velocity as a force to the rigid body and vice versa?

hidden wyvern
#

The way the Character body works, makes such approaches destined to look unnatural/bad. Especially because _physics_process is called before the physics step, so while just pushing the object and slowing down the player is a simple approach, it definitely doesn't work as a perfect solution

#

I can't really show an example, since I'm not at my PC

#

Basically it would make your player character lag 1 physics step before the rigid bodies.

placid lynx
#

I'm not sure what you mean.

hidden wyvern
#

In short, the solution you are trying to provide was tested with several different approaches, all of which looked poor.

#

I'm not pulling this "physics shadow" concept out of nowhere, since Rigid bodies and Character bodies don't mix well

placid lynx
#

This is what I've got. (Pushing rigid bodies is broken, but from what I've read it's because Godot 3 has a really jank depenetration system for all collision objects.)

hidden wyvern
#

Not sure how Godot 3 comes into play here, but Character body already has the ability to be pushed by rigid bodies (I sort of forgot to mention that) it's main problem is pushing rigid bodies and reacting to collisions with them. Since if a RigidBody is not moving, it acts as a StaticBody to the CharacterBody

placid lynx
#

Oh

#

I didn't know that added that.

hidden wyvern
#

I mean, technically speaking, it's not being pushed because of physics, but because of collision solving.

#

At least from my understanding

placid lynx
#

I just tested it without my rigidbody interaction code, and it seems that's also the case in 3. My code does interact with the physics, though.

#

I didn't show it in the video, but if I jump off the ground (to disable snapping), I will be thrown quite a ways away. Doesn't happen with the physics function removed.

hidden wyvern
#

Since like I mentioned

#

The being pushed away part is collision solving

#

Aka, not letting your character be inside the wall