Jump to content

EduduKohler

Resident
  • Posts

    2
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks for the reply, and thanks for trying the script! I'll try to figure out what's happening in my tests
  2. Hello guys, I'm trying to make some physics experiments with SL engine for a Uni project, and I could use some help with some things: 1) What's the best way of getting an object initial velocity after applying an impulse to it using llApplyImpulse? I've tried using the 'start_moving()' event but it never triggers, and I don't know why. If this is not possible with llApplyImpulse, for some reason, what's the best way I could simulate something like an oblique launch, in which I apply a momentary force to an object in two axis? I'm currently trying to keep track of these parameters using a timer, but I think the results are not that reliable. 2) Is the difference between two llGetPos() coordinates in meters? How can I move an object more than 10 meters? 3) I have a script that moves an object 10 meters up and then keeps track of its velocity during the fall. When I try to track its acceleration with llGetAccel it always returns <0,0,0>, why is that? I was expecting something like <0,0,-9.8> after reading the wiki. 4) For my simulations it would be nice to have objects mass expressed in kg. By reading the wiki I can't understand properly how the Lg metric works. What's the best way of 'converting' Lg to Kg? Edit: Just realized there's a function that returns mass in kgs 5) In order to kreep track of the object physical parameters, like velocity, position, acceleration and force, I'm using a timer function printing these values with llSay over time, but it's not printing more than two times per second. I imagined it could be something to do with the printing function performace, but I'm not sure. Is there a better way of doing this? Most of my doubts are about the relation between LSL units and real life units. I've read the wiki several times but I'm struggling to get these values properly inside the Sim. My goal here is to make physics tests such as free fall, oblique launch and collisions in the SL Sim and compare the results with the mathematical formulas for each behaviour. To achieve this I need to have proper values in metric system like initial velocity, distance, acceleration, mass. Could you guys give me some help with this? Thank you!!! These are the scripts I'm using for now: FREE FALL: float end = 0.0; float start = 0.0; default { state_entry() { llSetStatus(STATUS_PHYSICS, TRUE); } touch_end(integer num_detected) { llSetTimerEvent(0.1); llSetPos(llGetPos() + <0,0,10>); start = llGetTime(); vector initialAccel = llGetAccel(); llSay(0, "Initial position:"+(string)llGetPos()); } land_collision_start(vector pos) { end = llGetTime(); llSetTimerEvent(0.0); llSay(0,"I Collided With Land!"); llSay(0, "Final position:"+(string)pos); llSay(0, "Time elapsed:"); float elapsed = end - start; llSay(0, (string)elapsed+"s"); } timer() { llSay(0, "Velocity="+(string)llGetVel()); llSay(0, "Acceleration="+(string)llGetAccel()); llSay(0, "Force="+(string)llGetForce()); llSay(0, "Mass="+(string)llGetMass()); llSetText( "Script=teste_queda \n"+ "Velocity="+(string)llGetVel()+"\n"+ "Acceleration="+(string)llGetAccel()+"\n"+ "Force="+(string)llGetForce()+"\n"+ "Mass="+(string)llGetMass()+"\n", <1,1,1>, 1); } } OBLIQUE LAUNCH: float initialTime = 0.0; float finalTime = 0.0; vector initialPos; vector finalPos; default { state_entry() { llSetStatus(STATUS_PHYSICS, TRUE); } touch_end(integer num_detected) { llSay(0, "TEST START"); llSetStatus(STATUS_PHYSICS, TRUE); llSetTimerEvent(0.05); vector impulse = <0,10,10>; initialTime = llGetTime(); initialPos = llGetPos(); llApplyImpulse(impulse, 0); llSay(0,"INITIAL POSITION: "+(string)llGetPos()); } moving_start() { llSay(0,"INITIAL VELOCITY: "+(string)llGetVel()); } land_collision_start(vector pos) { finalTime = llGetTime(); finalPos = llGetPos(); llSetTimerEvent(0.0); vector distanceTraveled = finalPos - initialPos; float timeElapsed = finalTime - initialTime; llSay(0, "Distanced traveled:"+(string)distanceTraveled); llSay(0, "Time elapsed:"+(string)timeElapsed+"s"); } timer() { llSay(0, "Velocity="+(string)llGetVel()); llSay(0, "Position="+(string)llGetPos()); llSetText( "Script=teste_queda \n"+ "Velocity="+(string)llGetVel()+"\n"+ "Acceleration="+(string)llGetAccel()+"\n"+ "Force="+(string)llGetForce()+"\n"+ "Mass="+(string)llGetMass()+"\n", <1,1,1>, 1); } }
×
×
  • Create New...