hidden Loon Posted November 3, 2016 Posted November 3, 2016 Ok so I am making an object that will rez a meteor. The meteor will wall from the sky and then crash into a person/land/floor. When it makes contact, it will rez a crater...Now here is my question: Is there a way to make this:llRezObject("Object",llGetPos(),ZERO_VECTOR,llGetRot(),30);ALWAYS rez an object on the ground/floor rather than where ever the prim that will contain the script hits? I know you might have to do something with llGetPos BUT wouldnt those cords change with different things it hits? Thanks
Rolig Loon Posted November 3, 2016 Posted November 3, 2016 Try using llGetPos and then correcting the vertical position with llGround. The onlt thing you'll need to be aware of is that you can't rez an object more than 10m away from the rezzing script. If the ground is more than 10m below your target, then, you'll have to rez the object and then move it to the target location with a separate script.
Innula Zenovka Posted November 5, 2016 Posted November 5, 2016 Note that llGround() tells you where the ground is. So if the meteor strkes a floor on a skyplatorm 1000 metres up in the air, if you use llGround() then the crater is going to want to move toi 1000 metres below the platform, which probably isn't what you want. I'd suggest considering the question from a different angle. Your meteor, you say, is going to "crash into" something. That suggests to me that a collision event is going to occur. Helpfully, there's two sorts of collision event, simple collisions and land collisions, so you know whether you've collided with the land or not. Either way, you know the dimensions of the meteor, you know the dimensions of the crater you want it to rez, and you know where you want the crater in relation to the meteor, which I assume will appear part-buried in the crater anyway, so you have some wriggle-room. I'd have thought that when the meteor collides with something and stops, it would then be a simple calculation to rez the crater at llGetPos() + <0.0,0.0, -something>, the "something" being calculated by using the size of the meteor and the size of the crater. Alternatively, llCastRay should tell you very accurately where the nearest surface beneath you is (though it can be a bit flakey with some types of mesh) but that might be over-complicating things.
hidden Loon Posted November 7, 2016 Author Posted November 7, 2016 Is there not a command to make it rez on the nearest surface? Example: The meteor is rezzed and is falling from the sky, a guy flys under it and is 30m above the nearest surface/floor. When the Meteor hits said person, I would like the crater to then be able to spawn on the surface beneath the person it just hit. Or is this too far put of SL realm?
Rolig Loon Posted November 7, 2016 Posted November 7, 2016 No, there isn't. You have to provide some scripted method to determine where to rez the object. It might be a very simple method, like assuming that your target av is always standing on the ground or a solid surface and then writing vector AvSize = llGetAgentSize(llDetectedKey(0); llRezAtRoot(my_object,llDetectedPos() - <0.0,0.0,0.5*AvSize.z>, ZERO_VECTOR,ZERO_ROTATION, 1); Or you might take Innula's suggestion and use a cast ray to detect the position of a spot on some surface under the av. Or you might take my earlier suggestion and use llGround to get the ground elevation. One way or another, you have to script a calculated target position for your rezzed object, and the method you use will depend on the basic assumptions you have about geometry. The script can't just guess where the nearest surface is.
arton Rotaru Posted November 7, 2016 Posted November 7, 2016 You can rez the crater 100 % transparent, let the crater cast a ray straight down (rejecting AGENTS|PHYSICAL) to detect the surface below and move it with llSetRegionPos and make it visible when it's there.
Innula Zenovka Posted November 7, 2016 Posted November 7, 2016 hidden Loon wrote: Is there not a command to make it rez on the nearest surface? Example: The meteor is rezzed and is falling from the sky, a guy flys under it and is 30m above the nearest surface/floor. When the Meteor hits said person, I would like the crater to then be able to spawn on the surface beneath the person it just hit. Or is this too far put of SL realm? You need to tell the prim that you want it tind the nearest surface, using either llGround() if you're sure you want the crater to rez on the ground rather than on the nearest surface, or llCastRay() if you think it might be better to rez on the first solid object it meets. Either way, you are going to need to decide what to do if the guy it hits happens to be flying over a building at the moment of impact. (unless you want to take the chance of the crater ending up balanced on top ot a tower on someone's gothic castle or something).
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now