Hi,
is is possible to have a scaled Cylinder (with different scale values in axis X and Z) so that , seen from the top, it's an oval instead of a circle, (via the Cylinder entity)
[v1]Scaled cylinder
Re: [v1]Scaled cylinder
While shapes do not have any form of native scaling, it is possible to wrap them in a TransformableShape and use that to apply linear transforms like nonuniform scaling.
So for example, you could do this:
That will create a cylinder which is scaled up by a factor of 2 along its local x axis which can then be given to an entity.
(In v2, there's no TransformableShape equivalent planned. In both v1 and the final version of v2, a similar shape can be created using a convex hull approximation.)
So for example, you could do this:
Code: Select all
var transformableShape = new TransformableShape(new CylinderShape(1, 1), Matrix3x3.CreateScale(2, 1, 1));
(In v2, there's no TransformableShape equivalent planned. In both v1 and the final version of v2, a similar shape can be created using a convex hull approximation.)
Re: [v1]Scaled cylinder
thanks for such a fast answer! I'll be porting to v2 as soon as it's stable and gets a character controller, so the v2 bit is important.
I use that cylinder (and other shapes) for triggering, so I could use DetectorVolume instead. Is DetectorVolume (or something similar) being "ported" to v2?
I've been reluctant to use it because I've though that using a box collider instead of a triangle mesh should be faster (and because constructing it may lead to errors building the triangle mesh, while Cylinder is a basic entity), but if it's going to be in v2 (and not the TransformableShape as you said) I'd rather write code that will be reused for v2.
Or should the convex hull you suggested before be faster than the DetectorVolume?
thanks!
I use that cylinder (and other shapes) for triggering, so I could use DetectorVolume instead. Is DetectorVolume (or something similar) being "ported" to v2?
I've been reluctant to use it because I've though that using a box collider instead of a triangle mesh should be faster (and because constructing it may lead to errors building the triangle mesh, while Cylinder is a basic entity), but if it's going to be in v2 (and not the TransformableShape as you said) I'd rather write code that will be reused for v2.
Or should the convex hull you suggested before be faster than the DetectorVolume?
thanks!
Re: [v1]Scaled cylinder
A primitive box will indeed be much faster than a DetectorVolume. At the same level of detail, a convex hull will also tend to massively outperform mesh based implementations like the DetectorVolume, and I don't plan to bring a DetectorVolume equivalent to v2. (There will be collidable meshes, of course, just not with the specific DetectorVolume style "contained" vs "touching" vs "separated" features.)
Re: [v1]Scaled cylinder
Thanks, I'm using a convex hull for the cylinder now, it works and will be more portable to v2
Re: [v1]Scaled cylinder
Out of curiosity, could you use anything else besides the convex hull for the cylinder and get a similar result?
This top notch D-Bal Max review is worth reading.
Re: [v1]Scaled cylinder
If the goal is a nonuniformly scaled cylinder with ellipsoid caps, not really.
In v1, the full set of options is:
1) TransformableShape wrapping CylinderShape
2) ConvexHullShape approximation
3) Mesh approximation
4) Custom dedicated shape type
#1 is dropped in v2, #3 is way more expensive than #2, and #4 is a lot of work, especially in v2.
In v1, the full set of options is:
1) TransformableShape wrapping CylinderShape
2) ConvexHullShape approximation
3) Mesh approximation
4) Custom dedicated shape type
#1 is dropped in v2, #3 is way more expensive than #2, and #4 is a lot of work, especially in v2.