Page 1 of 1

New way of constructing Capsule

Posted: Wed Oct 27, 2010 3:36 pm
by flyingbag
Hi,

I want to suggest an alternate way of constructing a Capsule. For constructing a Capsule using an existing constructor we'll need a position (Vector3), a length (float and a radius (float) as below.

Code: Select all

public Capsule(Vector3 pos, float len, float rad);
May I suggest constructing a Capsule by specifying a beginning position (Vector3), an ending position (Vector3) and a radius (float), as below.

Code: Select all

public Capsule(Vector3 beg, Vector3 end, float rad);
In this way the code also is able to provide the position and orientation of the Capsule for us. One hassle I've been with using other physics engine was I often need to ensure the orientation of a capsule is right in different coordinate system. In specifying just begin and end position with the radius, it sounds (to me) more intuitive and axis neutral.

Thanks

flyingbag

Re: New way of constructing Capsule

Posted: Wed Oct 27, 2010 3:45 pm
by Norbo
Sure, I'll toss that in as an extra convenience constructor, and/or maybe a helper method (to extract an acceptable orientation to align the local up vector with a start/end location in general).