Unexpected Capsule shape settings

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
SugarGlider
Posts: 11
Joined: Mon Aug 05, 2019 12:06 pm

Unexpected Capsule shape settings

Post by SugarGlider »

Hi

So, I have terrain included in my physics and also character controllers for my player avatar. Im not sure if its a bug or just me making assumptions but took me awhile to work out why characters did not stand on the terrain exactly. Turns out the capsule height must be set using the following formula.

Code: Select all

CapsuleHeight = AvatarHeight - (CapsuleRadius * 2)
Seems a bit counter intuitive. I guess the height is for the cylinder part and the rounded ends are not included :oops:
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Unexpected Capsule shape settings

Post by Norbo »

Yup, the capsule 'length' refers to the length of the internal line segment, and the 'radius' is the spherical expansion around that line segment.

(The reasoning here was that any nonnegative value for length works under this interpretation, whereas if it referred to the line+radius, there would be invalid positive values.)
Post Reply