|
Aznavour Wolfe
Registered User
Join date: 19 Dec 2004
Posts: 9
|
07-14-2006 06:43
Heya all! I've been hunting for some info on this, but probably haven't found the right keywords to use...
Is it technically possible to build a "trace" rangefinder similar to what is used in some game engines? IOW, feed it a starting point and a vector, and it'll trace along the vector for a distance equal to the vector's magnitude and report the range from the starting point to the first object it encounters (or the end of the vector, if it doesn't encounter anything).
Could this be done by using an object (physical? non-physical?) as a "sonar ping"? What kind of delay would be involved, and what kind of maximum range would such a system have?
I seem to recall someone posting something about this somewhere, but for the life of me I can't remember who, what, where or when...
|
|
Draco18s Majestic
Registered User
Join date: 19 Sep 2005
Posts: 2,744
|
07-14-2006 10:04
2 ways that I know of. If you find a way to convert your vector into a rotation to point an object's +X axis in that direction and then use a sensor with a VERY narrow cone (like, .0000001 or something) then you'd get a "raytracing" object. Not the best, as it might miss very close objects.
The other way. Send out a bot-prim in the vector direction with collision enabled and wait for it to hit something. Then communicate it's world coordinates back to your main prim that does a distance calculation. Problems this way: to be accurate the object would have to make sure that it's not moving so fast as to skip over objects in its path as well as be moving fast enough to get the job done (this is why raytracing in computer rendering is expensive, this is EXACTLY what it's doing). I'd suggest llAppyImpuls to get the object moving, although you'll need to find a way of using it accurately.
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
07-14-2006 10:30
From: Draco18s Majestic 2 ways that I know of. If you find a way to convert your vector into a rotation to point an object's +X axis in that direction and then use a sensor with a VERY narrow cone (like, .0000001 or something) then you'd get a "raytracing" object. This should do: rotation vector2rot( vector Vector ) {
vector forward = llVecNorm( Vector ); vector left; if( (forward.z > 0.9999) || (forward.z < -0.9999) ) { // special case, pointing either straight up or down left = forward % <1.0, 0.0, 0.0>; } else{ // regular cases left = forward % <0.0, 0.0, 1.0>; } return llAxes2Rot( forward, left, forward % left ); }
default { touch_start(integer total_number) { vector target = <128.0, 128.0, 128.0>; llSetRot( vector2rot( target - llGetPos() )); } }
sample points at specific point in the sim, but the converting function simply provides rotation that matches supplied vector so can be used with anything really...
|
|
Aznavour Wolfe
Registered User
Join date: 19 Dec 2004
Posts: 9
|
07-17-2006 02:18
Thanks for all the suggestions. I'll be experimenting with collision-bots using both traditional "bullet" methods as well as llVolumeDetect (suggested by a friend) - will try and remember to post results 
|
|
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
|
07-17-2006 02:30
This came up recently on the forum here....
apparently llVolumeDetect only detects somthing moving _into_ the volume, and not when the volume move _onto_ something else, if you see what I mean
Someone was trying to use a long spike on the front of a bot to check ahead of it for walls and stuff, but it wouldn't work, as far as I recall.
So, if you do try the llVolumeDetect route, could you post back any successes that you have?
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
07-17-2006 03:05
I've tried using narrow sensors (problems as already stated, they're not much use) and volume detect sensor bullets (doesn't work, the collision events don't trigger). The only thing I got to work was shooting an invisible physical sensor bullet with buoyancy 1.0 that shouts and then dies when it collides with something. This actually works quite well... something like default { state_entry() { llSetBuoyancy(1.0); llSetAlpha(0.0, ALL_SIDES); llSetStatus(STATUS_PHYSICAL, TRUE); llCollisionSound("", 0.0); }
collision_start(integer n) { llShout(-12423904, (string)llDetectedKey(0)); llDie(); } } in the bullet. I have a sensor gun that does the whole thing - I don't think it's in my freebie box, but I'll put it in there when I get home.
|