float llCos(float theta)
Returns the
cosine of
theta radians.
Given a point on a circumference, it is the horizontal distance from the center, measured in radians.
____
| \
| B
| /|\
| / | \
| / | \
| / | |
A/____C___|D
not a good circle, but measures the distance
AC where
DB is the number of radians (
usually between 0 and TWO_PI) you must go around the circumference.
Radians | Angle | Cosine |
0 | 0 | 1 |
0.392699 | 22.5 | 0.923880 |
0.785398 | 45 | 0.707107 |
1.178097 | 67.5 | 0.382683 |
1.570796 | 90 | 0 |
1.963495 | 112.5 | -0.382684 |
2.356194 | 135 | -0.707107 |
2.748893 | 157.5 | -0.923880 |
3.141593 | 180 | -1 |
3.534292 | 202.5 | -0.923880 |
3.926991 | 225 | -0.707107 |
4.319690 | 247.5 | -0.382684 |
4.712389 | 270 | 0 |
5.105088 | 292.5 | 0.382684 |
5.497787 | 315 | 0.707107 |
5.890487 | 337.5 | 0.923880 |
The following will rez 16 objects around the object containing the script in a circle. It will use the first object in its inventory as the object to rez.
default
{
state_entry()
{
// name of first object in inventory
string name = llGetInventoryName(INVENTORY_OBJECT, 0);
// number of objects to rez
float count = 16;
// size of circle from center to the edge
float radius = 5.0;
// distance in radians between each object
float step = (1.0 / count) * TWO_PI;
// position on circumference to place object
float radians;
// move along circumference
for(radians = 0.0; radians < TWO_PI; radians += step)
{
// get x/y position of circumference
float x = llCos(radians) * radius;
float y = llSin(radians) * radius;
// translate relative to objects current position
vector pos = llGetPos();
pos.x += x;
pos.y += y;
// rez the object
llRezObject(name, pos, ZERO_VECTOR, ZERO_ROTATION, 0);
}
}
}
Compare with
llAcos.
This article wasn't helpful for you? Maybe the
related article at the LSL Portal is able to bring enlightenment.
Functions |
Math 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