1

I noticed that there are alot of funcitons that can raycast but they seem to use a const NxRay

My problem I am having is having a vehicle that is casting a ray downwards as being my NxRay. It is not constant because the vehicle can move in different angles, but I want to beable to ray cast to find out the distance it takes to hit the ground or other objects. Thanks.

Using C++, Glut, PhysX

Aer
  • 11
  • 2

2 Answers2

2

Why can't you just do the following?

NxRay ray;

// fill in ray structure here
// ray.dir = ...

// call a ray cast
// scene->raycastClosestBounds(ray, ...
// scene->raycastClosestShape(ray, ...

The const value in the raycast calls just assures you that it won't change those values. It doesn't mean you have to provide a const NxRay.

xgalaxy
  • 201
  • 3
  • 6
1

A C function taking a const parameter only means that the function does not modify its value, not that the value itself must be constant. For example, I can pass a non-const char * to the first parameter of printf(), even though that parameter is declared const char *.

So, you should have not problems using your variable NxRay as an argument to the ray casting functions.

Theran
  • 3,776
  • 20
  • 31