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.