#Understanding of Character Position (Game Developer Thinking)

1 messages · Page 1 of 1 (latest)

digital crow
#

I am creating a player controller script with rigidbody using addforce for movement from moving, jumping and other.

When my player “drops down” at the start and the Rigidbody settles on the ground,
the transform.position (center of the capsule) ends up negative in Y — because the collider’s pivot is at the center.

I checked that and found out that:
"But visually, your mesh still looks like it’s at Y = 0.
So the problem isn’t that the player moved — it’s that Unity measures from the center, not the feet."

I want it to be accurate so that in my "Game Manager" i can send down items or missles at his exacts location. Or for debugging purposes, knowing the exact amount of force was done to the player itself.

So as a programmer, is it important for me to fix this or am i like over complicating things here for myself.

ruby wigeon
# digital crow I am creating a player controller script with rigidbody using addforce for movem...

That text in the middle looks like you asked AI about this and for some reason value its response. If you want to learn properly, dont blindly use AI.
Unity isnt measuring anything here. You have an object which you are getting the position of, there is no "center" or "feet" of a transform for it to measure from. It doesnt matter if the y value is negative because its just a position. You can send items or have missiles fly at this position anyways.

#

If the object is at the center of the capsule and the Y value is negative, the only thing this means is that your floor is probably lower than y=0. Theres no issue with this. You could have your entire world live below y=-100 and nothing different will happen

primal orchid
#

I guess, the colliders origin is not on the "feet"/bottom aligned and therefore the OP is having issues with the character being off or the collision being off. You just gotta calculate your collider correctly starting from the "center" of your character and maybe adapt when crouching/falling and so on

frosty shuttle
#

The player is a GameObject; therefore, you can access its position from its transform. That's all you need to keep track of it

If you want a specific position on the player, create an empty child GameObject and place it where you want to track, and use that instead

You're definitely overthinking this . . .