Hi! I have a player character that I want to ride a horse.
Currently I’m using this code to sync the player to the horse’s movement. (They are both CharacterBody3D using move_and_slide() for movement)
func physics_update(delta:float) → void:
character.global_position = Global.horse.saddle.global_position #saddle position is a Node3D child to the CharacterBody3D
character.rotation = Global.horse.rotation
This however leads to slight lag between the two. (Rider falling slightly behind as the horse accelerates or turns)
Is there a better way to temporarily parent a node’s position to another node?
Thanks!
You can use self.reparent to reparent your player to the horse. RemoteTransform3D could also work better. I think your player is updating before the horse so it ends up one frame behind?
If I may ask a follow up question - Now that the AnimatedSprite3D’s are perfectly overlapping, I have a Z-sorting issue. I want to use Alpha Cut = Discard, which doesn’t seem to work with the Render Priority setting, which otherwise fixes the issue. Are there other workarounds for fixing Z-fighting on AnimatedSprites? Thanks in advance!
On sorting: I wouldn’t mess with render priorities unless you know exactly why you are doing so, Alpha Discard should work best on AnimatedSprite3D with no extra render priorities set. If your horse is also in the alpha pipeline I would try to fix that.
On Z-fighting: you just have to separate the meshes a little bit, it’s an inherit problem in games.