Vector problems

After mucking about with the Raytracing demo, I was (finally) able to work out how to make my own simulation using the raytracing ability. My simulation was working pretty well, but I'm stuck on one part. When my bot, a sphere, is created, I have eight sensors that are set up around it to represent a real robot that we just received. Among others, the robot's sensors include two that are angled straight out from the front, offset from the center by about .5 inches (using .5 offset in breve to represent it). Because the origins of the two raytraces (is that how you use the word?) representing the sensors, when the sphere object rotates, the lines/raytraces narrow or widen depending on their orientation.

If someone can point me in the direction of somewhere to place images, I would be happy to post screenshots of the simulation's problem.

I've narrowed the problem down to the origins of the lines not changing with the rotation of the sphere while they do keep the relative angle, making the lines seem to move together and apart depending on how the sphere moves about. I would rather not make this into a multibody, as it would unnecessarily complicate the sim.

I can't figure out (may be related to brain fry) how to move the origins to keep the proper orientation with the sphere as it rotates. This would probably be easier if I knew more about vectors and 3D math, but I haven't needed it until now, and had not planned on it being necessary when I set up my classes.. bah.

Thanks for any help!
~Moto

Vector problems

Maybe I'm not understanding the question properly, but have you tried using the Mobile method "transform" to turn the world vector into a rotated vector:

realworldlocation = ( self get-location ) + ( self transform world-vector ( .5, 0, 0 ) ).

- jon

Vector problems

JK,

I will definitely check this out. I've kind of reworked the sim so that I shouldn't need this, but if I CAN implement it, the sim would be a much more accurate portrail of my goals.

Thanks much!

~Moto

Vector problems

JK, thanks for the suggestion. I tried it, though, and got the same results as before using an offset.

Maybe this describes the problem better. If not, I'll just post the simulation.

..this is supposed to be a sphere..

._____
/........\
|...*....|
|.........|
\_____/

Most of the sensors begin at the asterisk. This is just like in the demo, and works fine. But I have two sensors that I want to be located on a different part of the sphere, and keep their orientation the same as the sphere.

._____
/........\
|..*..*.|
|.........|
\_____/

These I want to be at the two asterisks shown here.

Now, I've gotten the sensors to start at the right place by using an offset. I then used the method transform. Both produced the same results. The sensors don't rotate with the sphere. Their directions change properly and point correctly just like the other sensors (which are all Abstracts and use raytrace). But when the sphere rotates, they keep their same rotation.

So, this happens:

( 'I' represents the line coming from sphere A represents direction sphere faces)

begin like this, correct.
..I I
..I I
._____
/...A...\
|..*.*..|
|.........|
\_____/

Rotates 90 degrees,

._____
/........\
|..*.*.A| IIIII
|.........|
\_____/

The space between the offset lines appears to narrow as the sphere rotates because they don't rotate with the sphere, while their endpoint does. Thus, whenever my sphere moves around and makes a turn, the sensors change their orientation!

One solution I've thought of would be to affix the sensors' origins onto a part of the sphere, so that their origins move around with the sphere. I don't know how to do this, though, especially since they are Abstracts.

I hope this explains it a bit better.

I can see the problem, I understand what is wrong, but I can't figure out how to fix it! Bah!

Any help, as always, is appreciated.

~Moto

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.