Manipulating Collision Values on the Fly

Example code -

Amask.node().addSolid(CollisionRay(0, 0, 0, 0, +1, 0));

If I wanted to change the angle of that collison ray on the fly; lets say I wanted to make that +1 a +2; is it possible to do that or are those values non changeable after creation of the ray?

Is it valid to use variables for values instead of direct numeric values and will the Ray update with variable change?

Thats another way of asking it.

If you save a pointer to your CollisonRay object, you can adjust its values at any time with ray.setOrigin() and ray.setDirection().

However, it will not automatically update if you only change the variables that you used to create the CollisionRay. You have to actively call one of the set methods.


Would that be on the Path, or the Node()?

MyRay.setDirection() or MyRay.node().setDirection?

That would be on the CollisionRay. It’s neither a node nor does it have a NodePath.

self.ray = CollisionRay(0, 0, 0, 0, +1, 0)

self.ray.setDirection(0, -1, 0)


So I’m guessing a Ray is just a Vector Calculation then. I find myself using Vectors a lot, mostly for moving things around.

Master Drwr, please add in a moveTowardsPoint(Obj, Vec3(x,y,z), speed) function/method.

Such a function would simply move an object to a point and stop. I’ve implemented this, but I’m not the best programmer around. Mine works, but need some polishing (some things to fix with it).

I’ll clean it up later though.

You might be wondering about my Logic. Understand, I worked with 2D engines, then 2D/3D and now 3D. 3D is built on 2D and a lot of the Logic is really the same. Therefore, things that can be done under a 2D logic can be done under a 3D logic, but you have to be a top-notch programmer in order to implement. (Given the fact 3D is still just a 2D picture)

Most engines I’ve used had built in functions that converted 3D calculations to 2D. For instance, you might have a box on the screen and you want to get the 2D position of that box (even though it’s a 3D scene). That just basically mean you would want the 2D grid location of the box, based on the width and height of the current view on screen.

Built in functions like that would be so useful. I would rather not go out of the way and buffer anthying off screen just to implement that. It’s better off done on the graphic card side, but you would have to be into CG for that.