-
I am constructing an I would like to cast a sphere from world Y:20 to world Y:-20. There is a floor (box) at zero level. My attempt doesn't detect a hit: const position = new Jolt.Vec3(0, 20, 0);
const rotation = new Jolt.Quat(0, 0, 0, 1);
const direction = new Jolt.Vec3(0, -40, 0);
const scale = new Jolt.Vec3(1, 1, 1);
const transform = new Jolt.Mat44();
transform.sTranslation(position);
transform.sRotation(rotation);
// not sure if scale is needed, but setting it as well
transform.sScale(scale);
const shapeCast = new Jolt.RShapeCast(shape, scale, transform, direction);
// using CastShapeClosestHitCollisionCollector for collector
system.GetNarrowPhaseQuery().CastShape(shapeCast, castSettings, offset, collector, bpFilter, objFilter, bodyFilter, shapeFilter); Sime params for casting ray work fine, though. Ray can detect the floor and all the objects on top of it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Functions prefixed by an 's' are static functions, so they will not modify You'll want to use:
or simply:
since your rotation is identity. This matrix cannot contain any scale (you're passing scale as a separate parameter to |
Beta Was this translation helpful? Give feedback.
Functions prefixed by an 's' are static functions, so they will not modify
transform
, their purpose is to create a matrix.You'll want to use:
or simply:
since your rotation is identity.
This matrix cannot contain any scale (you're passing scale as a separate parameter to
CastShape
).