Unexpected Capsule shape settings

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

Unexpected Capsule shape settings

Post by SugarGlider » Sun Aug 25, 2019 10:43 pm

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: 4723
Joined: Tue Jul 04, 2006 4:45 am

Re: Unexpected Capsule shape settings

Post by Norbo » Mon Aug 26, 2019 6:47 pm

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

Who is online

Users browsing this forum: No registered users and 54 guests