Jump to content

Bullet that only collides with specific objects while remaining phantom to everything else


Leo1452
 Share

You are about to reply to a thread that has been inactive for 1084 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm making a sort of laser beam game where people ride cars that shoot blasts. The cars don't move with physics. The blasts should pass through through everything except the cars that are part of the game. Is there a way to make a bullet that only collides with objects of a certain name? If not, is there a way to make a phantom bullet that notices when it's passed through objects of a certain name so that it can perform some sort of reaction?

Link to comment
Share on other sites

2 minutes ago, Leo1452 said:

How would you combine that with the laser blast so that it lines up with what the blast has passed through?

it really depends on what your 'lazer blast' is, how the 'player' is telling it to fire etc. etc. Off the top of my head, here are a couple ways of implementing something like this:

1. Particle lazer.

You can get a stream of particles to shoot out of the z-axis of a prim. raycast from the particle emitter's position (pos) to pos+distance*llRot2Up(llGetRot()); to determine what the particles are likely to hit.

2. cylinder prim lazer.

rez a long (enough to hit its target) thin 1/2 sliced (saves you from having to figure out where to rez it, just rez it where it fires from) cylinder and have it quickly llLookAt whatever direction it's firing in (tip: rez it invisible and set it visible after it's looking in the right direction). the raycasting bit should actually be about the same in this case, as the length of a cylinder is its z-axis. Optionally have a fancy animated texture on the prim to make it look like a lazer beam moving from source to destination.

3. moving bullet.

this is most similar to what you asked for, but it's probably a bit laggy. Rez a 'bullet' and have it llLookAt its heading as in #2. Use llSLPPF in a timer to move the bullet incrementally along its heading and llSensor() for your desired target after each movement.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Quistessa said:

rez a long (enough to hit its target) thin 1/2 sliced (saves you from having to figure out where to rez it, just rez it where it fires from) cylinder and have it quickly llLookAt whatever direction it's firing in (tip: rez it invisible and set it visible after it's looking in the right direction). the ray-casting bit should actually be about the same in this case, as the length of a cylinder is its z-axis. Optionally have a fancy animated texture on the prim to make it look like a lazer beam moving from source to destination.

That's a good idea. If you do this, rez it before you need it (say when someone draws their weapon) as invisible, and of course, phantom. Rezzing can be slow, but setting position and orientation is fast. Then trigger a texture animation to show the motion, non-looped. The animation should start and end transparent, so all the beam action is done by the texture animation. Also trigger your "zap" sound at that time. All those operations are fast ones.

When you get this going, please post a location in world where we can see it. SL is not a great platform for shooters, but with effort, it's possible to do something good.

  • Like 2
Link to comment
Share on other sites

29 minutes ago, animats said:

When you get this going, please post a location in world where we can see it. SL is not a great platform for shooters, but with effort, it's possible to do something good.

If you search for "SLMC" (SL military community), you should find a bunch of sims owned by different groups that exclusively do a lot of shooting at each other. (Usually pretty competitive.)

The community itself isn't what it used to be in terms of size or activity, but there's been a great deal of R&D put into making shooters/combat fun in SL. Epsilon is one of the currently active groups I'm most familiar with and I've done a few projects for them.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

This is a much simpler problem to solve if you break it down into separate events.

Player fires a shot, calculate if they hit - this can be done with raycasts, or by broadcasting the beams trajectory as a chat message and having every target check that against their own position and respond if hit. Lean on LL systems as much as possible simply for speed, when using chat, range is limited to 20M, targets dont need to work out if the shooter is in range, etc etc. (invent lore to explain this weirdly convent range)

SL is sloppy for combat systems, design the hit box detection with that in mind. Favor the shooter., allow close enough and report results quickly.

Have your special effect all ready do go, make it bright and cheesy and most impotently, last long enough for the human players to see it .. fudge it a bit if needed - the math may say 'close enough to count' make the fancy  effect say "NAILED IT!", it makes the players feel good and papers over the complex round trip latency / server fps dance that's actually happening.

DONT !

Actually fire a prim projectile and hope the physics engine will magically pick up the ball and deliver it anywhere useful. It wont and your players will end up basing their playstyle around spam and splash damage.

Edited by Coffee Pancake
typo
  • Like 3
Link to comment
Share on other sites

8 hours ago, Leo1452 said:

Is there a way to make a bullet that only collides with objects of a certain name? If not, is there a way to make a phantom bullet that notices when it's passed through objects of a certain name so that it can perform some sort of reaction?

for these bullets then a way is llVolumeDetect:  http://wiki.secondlife.com/wiki/LlVolumeDetect

volume detect bullets act like they are phantom yet will fire a collision_start event

in the bullet start_collision event then fetch the name of the struck object with llDetectedName

if car name is detected then set the bullet to non-physical. Move it back to the grid position of the detected car and blow up the car

 

Edited by Mollymews
  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1084 days.

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
 Share

×
×
  • Create New...