Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help with a turret script

Rob Shark
Registered User
Join date: 17 Dec 2004
Posts: 5
06-24-2005 13:04
A lil while ago I created a turret script that automatically tracks the nearest avater, but I havn't been able to use it when linked to another object

CODE

sensor(integer total_number)
{
vector pos = llDetectedPos(0);
vector vel = llDetectedVel(0);
llLookAt(pos+vel, .1 , 1);
if(armed == TRUE)
{
llRezObject("Bullet",llGetPos(),<0,0,40>*llGetRot(),llGetRot(),1);
}

}


At the moment it uses llLookAt which as I've found is bloody useless when linked

Any help would be appreciated
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
06-25-2005 18:14
Instead of llLookAt use llSetLocalRot(); You'll have to play with it a bit after that point.
Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
06-26-2005 12:43
You can't really rotate multiple linked prims around very easily either, so you might have you use a single-prim turret.
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.
Rob Shark
Registered User
Join date: 17 Dec 2004
Posts: 5
06-26-2005 12:47
It is a single prim turret, at the moment I'm struggling with llSetLocalRot as it wants a rotation and not a vector that llLookAt does.

Any hints on how to this to work??
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
06-26-2005 16:48
Look at the wiki page for llLookAt or llRotLookAt, I posted a function that takes a position and converts it into a rotation that points an axis of the object at the position.
==Chris
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
Rob Shark
Registered User
Join date: 17 Dec 2004
Posts: 5
06-26-2005 18:10
Its all working now thank ya dudes for ya help!