Projectiles that inherit FastProjectile don't bounce

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
SPZ1
Posts: 281
Joined: Wed Aug 02, 2017 3:01 pm
Location: Illinois
Contact:

Projectiles that inherit FastProjectile don't bounce

Post by SPZ1 »

I don't know if it is a bug or if it is a 'feature', but bouncing doesn't work if FastProjectile is inherited. In the demo I made, you can see that the blue fireball will not bounce! :evil:
Attachments
Fast_Projectile_Doesn't_Bounce.7z
Open with Doom2.wad,
(696 Bytes) Downloaded 1 time
peewee_RotA
Posts: 373
Joined: Fri Feb 07, 2014 6:45 am

Re: Projectiles that inherit FastProjectile don't bounce

Post by peewee_RotA »

I think the culprit is that fast projectiles attempt to move in Tick. They also do extra collision detection and remove themselves.

I ran into this once because I wanted a bouncing ripper projectile. I ended up removing fast projectile and just having a high velocity. (And since made it slower)

Anyway, you can probably find a way to work around it. If you just need trails you can always just spawn them in Tick in a similar way
peewee_RotA
Posts: 373
Joined: Fri Feb 07, 2014 6:45 am

Re: Projectiles that inherit FastProjectile don't bounce

Post by peewee_RotA »

Oh, one particularly lame animation trick used in some games in the past is to make the actual effect a hitscan, apply your damage and everything, then use whatever you want to animate after the fact.

For example shoot a hitscan, and fire a really fast +NOBLOCKMAP collision projectile behind it to simulate the effect.
User avatar
SPZ1
Posts: 281
Joined: Wed Aug 02, 2017 3:01 pm
Location: Illinois
Contact:

Re: Projectiles that inherit FastProjectile don't bounce

Post by SPZ1 »

That isn't really good enough though. There should be a proper means of fixing this. :shrug:
peewee_RotA
Posts: 373
Joined: Fri Feb 07, 2014 6:45 am

Re: Projectiles that inherit FastProjectile don't bounce

Post by peewee_RotA »

Since it's designed not to bounce, the proper approach would be to copy the fast projectile code and write in some exceptions. The risk of doing it any other way is that at the core of every 3d engine, collision can be affected if things move too fast. Sometimes you absolutely have to hitscan between position 1 and position 2 to make sure it works. (Or simulate movement slowly another way)

Generating a new projectile at a mirrored angle on a collision event will be your fastest path forward.
User avatar
SPZ1
Posts: 281
Joined: Wed Aug 02, 2017 3:01 pm
Location: Illinois
Contact:

Re: Projectiles that inherit FastProjectile don't bounce

Post by SPZ1 »

I just noticed that the wiki says bouncing doesn't work. :oops:

The zscript code for fastprojectile is one complicated piece of work! I found that coding a simpler bounce is somewhat possible. Using A_SpawnProjectile in the death state of the fastprojectile and spawning something like this (see code) works with only one problem: The projectile will noclip through targets if they are too close. Since they wouldn't ever get hit with a bounce otherwise, it is a small improvement.

Code: Select all

ACTOR Rebound : ArachnotronPlasma {
	+NOCLIP

	States {
	   Spawn:
		APLS A 0 { bNOCLIP = FALSE; }
		APLS AB 5 BRIGHT
		Loop
   }
}
peewee_RotA
Posts: 373
Joined: Fri Feb 07, 2014 6:45 am

Re: Projectiles that inherit FastProjectile don't bounce

Post by peewee_RotA »

Awesome! Glad you have some progress.

Would reducing the radius help that problem by chance? Oh, and possibly having noclip on when it first spawns causes an unexpected sideffect.

Some projectiles have spawning issues, like Hexen's Ice Shards and the Hammer of Retribution so they do do special logic before attempting to spawn.
Post Reply

Return to “Scripting”