Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public struct IUpdateRaycastCommandsJob : IJobParallelFor
[ReadOnly]
public Vector3 origin;
[ReadOnly]
public Matrix4x4 localToWorldMatrix;
public quaternion rotation;
[ReadOnly]
public float maxRange;
[ReadOnly]
Expand All @@ -28,7 +28,7 @@ public struct IUpdateRaycastCommandsJob : IJobParallelFor

public void Execute(int index)
{
raycastCommands[index] = new(origin, localToWorldMatrix * (Vector3)directions[index + indexOffset], queryParameters, maxRange);
raycastCommands[index] = new(origin, math.normalize(math.mul(rotation, directions[index + indexOffset])), queryParameters, maxRange);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void SetupJobs()
_updateRaycastCommandsJob = new IUpdateRaycastCommandsJob()
{
origin = _transform.position,
localToWorldMatrix = _transform.localToWorldMatrix,
rotation = _transform.rotation,
maxRange = maxRange,
queryParameters = new() { layerMask = _raycastLayerMask },
directions = _directions,
Expand Down Expand Up @@ -100,7 +100,7 @@ private void SetupJobs()
protected override IEnumerator UpdateSensor()
{
_updateRaycastCommandsJob.origin = _transform.position;
_updateRaycastCommandsJob.localToWorldMatrix = _transform.localToWorldMatrix;
_updateRaycastCommandsJob.rotation = _transform.rotation;

JobHandle updateRaycastCommandsJobHandle = _updateRaycastCommandsJob.Schedule(pointsNum, 1024);
JobHandle updateGaussianNoisesJobHandle = _updateGaussianNoisesJob.Schedule(pointsNum, 1, updateRaycastCommandsJobHandle);
Expand Down
Loading