Don't click here unless you want to be banned.

LSL Wiki : llLookAt

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
llLookAt(vector target, float strength, float damping)

Causes the object to point the up (Z) axis toward target. Good strength values are around half the mass of the object and good damping values are less than 1/10th of the strength. Asymmetrical shapes require smaller damping. Calling llStopLookAt cancels the function.

This function works for both physical and non-physical objects.

llLookAt works on attachments also but it's rotation is relative to the avatar's that it is attached to.

Unlike llSetRot this function will rotate the object around its center of gravity.

Note: within the LSL editor, the tooltip for llLookAt reads "llLookAt(vector target, F32 strength, F32 damping)". F32 refers to a 32-bit float. In LSL, all floats are 32-bit.

Just in case you need an axis other then the up axis pointed at a target, here's a useful code snippet:
// AXIS_* constants, represent the unit vector 1 unit on the specified axis.
vector AXIS_UP = <0,0,1>;
vector AXIS_LEFT = <0,1,0>;
vector AXIS_FWD = <1,0,0>;

// getRotToPointAxisAt()
// Gets the rotation to point the specified axis at the specified position.
// @param axis The axis to point. Easiest to just use an AXIS_* constant.
// @param target The target, in region-local coordinates, to point the axis at.
// @return The rotation necessary to point axis at target.
// Created by Ope Rand, modifyed by Christopher Omega
rotation getRotToPointAxisAt(vector axis, vector target) {
    return llGetRot() * llRotBetween(axis * llGetRot(), target - llGetPos());

// Strength and damping are values used to control how llRotLookAt and llLookAt move, these values are tunable.
float strength = 1.0;
float damping = 1.0;

default {
    state_entry() {
        vector target = <10, 20, 30>; // A vector to look at.

        // These two lines are equivalent, and point the up (Z) axis at the target:
        llRotLookAt(getRotToPointAxisAt(AXIS_UP, target), strength, damping);
        llLookAt(target, strength, damping);

        // This line points the fwd (X) axis at the target:
        llRotLookAt(getRotToPointAxisAt(AXIS_FWD, target), strength, damping);

        // This line points the left (Y) axis at the target:
        llRotLookAt(getRotToPointAxisAt(AXIS_LEFT, target), strength, damping);
A strange example to have here since the getRotToPointAxisAt stuff is used for the llRotLookAt function and the llLookAt is only there for a comparison. I'll make use of it anyway. ;-)

Compare with llRotLookAt.

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Dynamics | Rotation Jasa SEO Jasa SEO Murah Sepatu Online Toko Sepatu Online Sepatu Sepatu Murah Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Berita Terkini Internet Marketer Muda Internet Marketer Indonesia Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Kursus SEO Kursus SEO Murah Jam Tangan Casio Jam Tangan Casio Jam Tangan Murah Jam Tangan Grosir Baju Terbaru Grosir Baju Baju Terbaru Grosir Baju Murah Bisnis Online Belajar SEO Kerupuk Kerupuk kulit Social Bookmark Dofollow Social Bookmark Kumpulan Puisi Kirim Puisi bola hantu Penumbuh Rambut Penumbuh Rambut timbangan WBC Wonogiri Jasa SEO Murah Jasa SEO Jam Tangan Murah
There are 11 comments on this page. [Display comments/form]