Need Help Understanding How to Assign an Avatar

Yes, that does happen as well; however it happens before I actually touch the ground correctly, which is what I want to correct. Do you know the proper distance to ground value I should use?

MaxDistanceToGround should depend on where your character’s pivot is positioned. If it is in the center, the ray must be longer than if it were on the feet (half the character’s height + “a few centesimals”), otherwise it would not reach the ground and Hit would always be false.
However, if it is too long, the RayCast would occur before the character hits the ground.
Nobody can tell you the length of the ray, you have to calculate it based on the position of the pivot and the height of the character if pivot is not positioned on its feet. Otherwise, very little is enough.

Okay, I used the pivot’s origin set to the character’s translation, so the length/distance should be the character’s height in that case?

Maybe yes, but I am not sure entirely where exactly the translation of the character is located number wise - perhaps at its center, like its literal geometric center?

Cause again, something as small as “4.3” vs “4.32” made a huge change in the outcome, which was my point earlier - like the character shouldn’t be that far up in the air before registering as touching.

And now when I go look, I can’t seem to find out how to figure out what the character’s height is, cause it isn’t listed clearly under the properties and I can’t find it in the API as a property of TCastleTransform or anything like that.

Do you know how you’re supposed to calculate an exact number for the character’s height?

Okay, I saw “Height” as a function of TCastleTransform, but it’s a boolean rather than a single value, and the Vector3 that the raycast uses doesn’t accept boolean parameters/inputs.

I did see however, “MiddleHeight”, and it’s how high the eyeballs are if what the API tells me is correct (and I trust it is), so I think that’s a good measurement for calculating the character’s height.

Unfortunately the collision didn’t register with that particular test value; I am really not sure what value I should use at this point to ensure I get the correct height. Could someone please help me figure it out?

Try this code in Update and change the value of MaxDistanceToGround little by little. See what happens to the label.

Also, I repeat that I know very little about the CGE API, but does AvatarRigibody have an editable collider? Does the collider “fill” the entire character?
The ray starts from AvatarRigidBody, which if it has a smaller collider than the character gives you staggered results.

Oh, I already do that in the test, like change the LabelFPS Caption depending on if the test is succesful or not;

But I can try the collider of the character. That is a very useful suggestion and thank you so much for it!

One more thing: open a new post, the title doesn’t reflect the discussion and in any case it’s excessively long now.