-
Hi, I'm writing a multiplayer game where a tank moves around, using bevy_rapier2d for the physics. I'm attaching a text bar with player name and health under the tank, but didn't want the text to rotate when the tank did, so tried the following hierarchy:
I use the Velocity::linvel of the player entity to control the velocity and Velocity::angvel of the tank for rotation. This works for most situations - the text bundle displays correctly, and remains under the tank,when moving and rotating the tank (and turret). However when the tank collides with an object and stops, both the Player entity and the Name keep moving. If I try adding LockedAxes::TRANSLATION_LOCKED to the Tank entity, the tank can move raggedly through objects, following the player entity. I saw the bevy_simple_stat_bars plugin, but was hoping there was a more elegant solution using hierarchies. Any suggestions? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
(Making some assumptions about how the rest of your message was going to go...) Bevy's transform propagation is all-or-nothing. There's no way to to disable only rotation. Here are a couple options:
Edit: The solution you attempted is interesting, and that sort of thing would generally work, but I'm not sure about the specific issue you're seeing with |
Beta Was this translation helpful? Give feedback.
(Making some assumptions about how the rest of your message was going to go...)
Bevy's transform propagation is all-or-nothing. There's no way to to disable only rotation.
Here are a couple options:
Follows(Entity)
component) and write a system to propagate only the translation from the entity being followed.Edit: The solution you attempted is interesting, and that sort of thing would generally work, but I'm not sure about the specific issue you're seeing with
bevy_rapier
.