RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
|
07-11-2005 14:47
default { state_entry() { llSay(0, "Hello, Avatar!"); }
touch_start(integer total_number) { llSetStatus(PRIM_PHANTOM,TRUE); } }
for some reason I'm not getting a phantom object when it gets a direct hit its turning phisical instead and it is intersecting other objects which I thought would make that impossible not to mention I never told it to be I'm new to this colision event does that make something phisical? i'm tryoing to make it smoke on a near miss and burn up if its hit then hacve stuff be abl;e to pass throiugh it and hit stuff behind it playing with catapults in marroon i guess ill bug report it . but I never get anything but form letters from that.
|
Michael Psaltery
Registered User
Join date: 6 Jun 2004
Posts: 57
|
07-11-2005 15:12
Off the top of my head, as I look at your code, I would consider doing something like automatically setting a random channel number for your listens with a variable that you assign a random number in state entry. This will keep people who see this post from messing with your script, and will keep multiple objects from interfering with each other. I notice in your collision handler that you jump to another state which then turns phantom off. Could it be this is happening more quickly than you expected? I don't see anything in your default state entry to set physics on, but collisions won't happen if physics is off (or rather, they're not processed for the object but still can be for other objects that collide with it), so I'm guessing you turn it on with the editor. I also don't see anything in there to turn off physics, so guess it's on the whole time. Note this can under normal circumstances result in objects falling below the ground, as they have physics on, so they fall, but collisions are off due to phantom, so they pass right through the ground. I'm pretty sure it HAS to be physical in order to process collision events, and wonder if using collision_start() automatically makes it physical? Check the wiki documentation for physics and collisions. The best way to ensure your physics is off is to explicitly turn it off. From: RacerX Gullwing
// Particle Script 0.3 // Created by Ama Omega // 10-10-2003 // Fixed up by Evil Fool vector pos; // Mask Flags - set to TRUE to enable integer glow = TRUE; // Make the particles glow integer bounce = FALSE; // Make particles bounce on Z plan of object integer interpColor = TRUE; // Go from start to end color integer interpSize = TRUE; // Go from start to end size integer wind = FALSE; // Particles effected by wind integer followSource = FALSE; // Particles follow the source integer followVel = TRUE; // Particles turn to velocity direction
// Choose a pattern from the following: // PSYS_SRC_PATTERN_EXPLODE // PSYS_SRC_PATTERN_DROP // PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY // PSYS_SRC_PATTERN_ANGLE_CONE integer pattern = PSYS_SRC_PATTERN_EXPLODE; // PSYS_SRC_PATTERN_ANGLE
// Select a target for particles to go towards // "" for no target, "owner" will follow object owner // and "self" will target this object // or put the key of an object for particles to go to key target = "";
// Particle paramaters float age = 3; // Life of each particle float maxSpeed = 1; // Max speed each particle is spit out at float minSpeed = 1; // Min speed each particle is spit out at string texture; // Texture used for particles, default used if blank float startAlpha = 1; // Start alpha (transparency) value float endAlpha = 1; // End alpha (transparency) value vector startColor = <0,0,0>; // Start color of particles <R,G,B> vector endColor = <0,0,0>; // End color of particles <R,G,B> (if interpColor == TRUE) vector startSize = <0.6,0.6,0>; // Start size of particles vector endSize = <0.1,0.1,1>; // End size of particles (if interpSize == TRUE) vector push = <0,0,-0.1>; // Force pushed on particles
// System paramaters float rate = .1; // How fast (rate) to emit particles float radius = 0.3; // Radius to emit particles for BURST pattern integer count =25; // How many particles to emit per BURST float outerAngle =PI_BY_TWO; // Outer angle for all ANGLE patterns float innerAngle = PI; // Inner angle for all ANGLE patterns vector omega = <0,0,0>; // Rotation of ANGLE patterns around the source float life = 0; // Life in seconds for the system to make particles
// Script variables integer flags;
updateParticles() { if (target == "owner") target = llGetOwner(); if (target == "self") target = llGetKey(); if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK; if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK; if (interpColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK; if (interpSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK; if (wind) flags = flags | PSYS_PART_WIND_MASK; if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK; if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK; if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
llParticleSystem([ PSYS_PART_MAX_AGE,age, PSYS_PART_FLAGS,flags, PSYS_PART_START_COLOR, startColor, PSYS_PART_END_COLOR, endColor, PSYS_PART_START_SCALE,startSize, PSYS_PART_END_SCALE,endSize, PSYS_SRC_PATTERN, pattern, PSYS_SRC_BURST_RATE,rate, PSYS_SRC_ACCEL, push, PSYS_SRC_BURST_PART_COUNT,count, PSYS_SRC_BURST_RADIUS,radius, PSYS_SRC_BURST_SPEED_MIN,minSpeed, PSYS_SRC_BURST_SPEED_MAX,maxSpeed, PSYS_SRC_TARGET_KEY,target, PSYS_SRC_INNERANGLE,innerAngle, PSYS_SRC_OUTERANGLE,outerAngle, PSYS_SRC_OMEGA, omega, PSYS_SRC_MAX_AGE, life, PSYS_SRC_TEXTURE, texture, PSYS_PART_START_ALPHA, startAlpha, PSYS_PART_END_ALPHA, endAlpha ]); }
default { state_entry() { llSetAlpha(1,ALL_SIDES); llSetStatus(PRIM_PHANTOM,FALSE); llParticleSystem([]); llListen(9,"","","dis"); llListen(11,"",llGetOwner(),"show"); llCollisionFilter("big o rock white", NULL_KEY, TRUE); } collision_start(integer detected) { llRezObject("roof1",llGetPos()+<1.42111, -1.68676, 0.00000>,ZERO_VECTOR,<-0.00000, -1.00000, -0.00000, 0.00000>,0); llSleep(0.2); llRezObject("roof2",llGetPos()+<1.12337, 1.36177, 0.00000>,ZERO_VECTOR,<-0.00000, 0.70711, -0.00000, 0.70711>,0); llSleep(0.2); llRezObject("roof3",llGetPos()+<-1.73816, 1.87745, 0.00000>,ZERO_VECTOR,<0.00000, 0.00000, 0.00000, 1.00000>,0); llSleep(0.2); llRezObject("roof4",llGetPos()+<-1.19926, -1.41436, 0.21296>,ZERO_VECTOR,<0.00000, -0.70711, 0.00000, 0.70711>,0); llSetAlpha(0,ALL_SIDES); // llResetScript(); llSleep(1); radius = 0.2; startColor = <1,0,0>; endColor = <1,1,0>; push = <0,0,0.01>; updateParticles(); radius = 0.2; llPlaySound("thunder",0.2); llSleep(1); llParticleSystem([]); llSleep(1); endAlpha = 0.5; age = 5; radius = 0.3; startSize = <0.3,0.3,0>; startColor = <1,0,0>; endColor = <1,0,0>; push = <0,0,0>; updateParticles(); llSleep(5); age = 2; // Life of each particle maxSpeed = 1; // Max speed each particle is spit out at minSpeed = 1; // Min speed each particle is spit out at texture = ""; // Texture used for particles, default used if blank startAlpha = 1; // Start alpha (transparency) value endAlpha = 0.3; // End alpha (transparency) value startColor = <0,0,0>; // Start color of particles <R,G,B> endColor = <1,1,1>; // End color of particles <R,G,B> (if interpColor == TRUE) startSize = <0.3,0.3,.1>; // Start size of particles endSize = <0.3,0.3,3>; // End size of particles (if interpSize == TRUE) push = <0,0,0.1>; llParticleSystem([]); llSetAlpha(0,ALL_SIDES); llSetStatus(PRIM_PHANTOM,TRUE); state wait; // Force pushed on particles } listen( integer channel, string sender, key sender_id, string sender_message ) { if(sender_message=="dis") { // makes it smoke if its in whisper distance of a hit age = 7; startAlpha = 0.3; // Start alpha (transparency) value endAlpha = 0.1; // End alpha (transparency) value startColor = <0,0,0>; // Start color of particles <R,G,B> endColor = <0.5,0.5,0.5>; // End color of particles <R,G,B> (if interpColor == TRUE) startSize = <5,5,.1>; // Start size of particles endSize = <5,5,3>; // End size of particles (if interpSize == TRUE) push = <0,0,0.1>; rate = .5; // How fast (rate) to emit particles radius = 0.1; // Radius to emit particles for BURST pattern count =5; // How many particles to emit per BURST outerAngle = 1.55; // Outer angle for all ANGLE patterns innerAngle = 0; // Inner angle for all ANGLE patterns omega = <0,0,0>; updateParticles(); llSleep(1);
} if(sender_message=="show") { llParticleSystem([]); llSetAlpha(1,ALL_SIDES); llSetStatus(PRIM_PHANTOM,FALSE); state default; } } } state wait { state_entry() { llListen(987654321,"","","show"); } listen( integer channel, string sender, key sender_id, string sender_message ) { if(sender_message == "show") { llSetAlpha(1,ALL_SIDES); llSetStatus(PRIM_PHANTOM,FALSE); state default; } } }
for some reason I'm not getting a phantom object when it gets a direct hit its turning phisical instead and it is intersecting other objects which I thought would make that impossible not to mention I never told it to be I'm new to this colision event does that make something phisical? i'm tryoing to make it smoke on a near miss and burn up if its hit then hacve stuff be abl;e to pass throiugh it and hit stuff behind it playing with catapults in marroon i guess ill bug report it . but I never get anything but form letters from that.
|
Catherine Omega
Geometry Ninja
Join date: 10 Jan 2003
Posts: 2,053
|
07-11-2005 15:19
Your problem is that you're doing this: "llSetStatus(PRIM_PHANTOM,FALSE);" PRIM_PHANTOM is a constant used by llSetPrimitiveParams and llGetPrimitiveParams. It has a value of 5. STATUS_PHANTOM is a constant used by llSetStatus. It has a value of 16. You can't substitute one for the other. When you give llSetStatus a value of 5, you're telling it to activate STATUS_PHYSICS (value of 1) and STATUS_ROTATE_Y (value of 4).
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
07-11-2005 19:23
On a related note, occasionally setting an object as Phantom directly from the Prim Editor will throw the "Cannot become Physical" interpenetrating error. Not sure why.
_____________________
---
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
07-11-2005 19:52
From: Michael Psaltery I don't see anything in your default state entry to set physics on, but collisions won't happen if physics is off (or rather, they're not processed for the object but still can be for other objects that collide with it), so I'm guessing you turn it on with the editor. I also don't see anything in there to turn off physics, so guess it's on the whole time. Note this can under normal circumstances result in objects falling below the ground, as they have physics on, so they fall, but collisions are off due to phantom, so they pass right through the ground. Objects that have been set phantom using llSetStatus, llSetPrimitiveParams, or the edit mode checkbox do not fall through the ground. The fall-through-ground bug only happens when you use llVolumeDetect. From: Michael Psaltery I'm pretty sure it HAS to be physical in order to process collision events, and wonder if using collision_start() automatically makes it physical? Check the wiki documentation for physics and collisions. The best way to ensure your physics is off is to explicitly turn it off. Objects do not need to be physical to receive collision events. Both objects involved in a collision will receive collision events whether or not they're physical. (Of course, one of them has to be in order for the collision to happen in the first place).  ==Chris
|
RacerX Gullwing
Magic Rabbit
Join date: 18 Jun 2004
Posts: 371
|
07-11-2005 23:46
ya was confused had my complicated code up and then simplified it and it still didnt work then someone told me i was sposed to use status_phantom not prim_phantom but thanks anyway it works now theres a catapult sitting on a casle in maroon if you touch it it foires at the castle across the valley so far only ythe dark castle crumbles
|