Help with 3d Projectile

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!)
Collegia Titanica
Posts: 83
Joined: Thu Jan 25, 2018 1:37 pm

Help with 3d Projectile

Post by Collegia Titanica »

I'm using a 3d Model of a missile on a homing projectile, therefor there are a few problems regarding visuals.


1) The AngleOffset parameter in MODELDEF does nothing in my case.(works for other models)

2) If I put

Code: Select all

METE A 0 A_SetAngle (90+Angle, 0, AAPTR_DEFAULT)
it rotates the model facing forward like it should, but without the AngleOffset working, I cannot just use this same line in the looping state since it curves my trajectory and crashes sideways into some wall.

To Combat This, I've rotated the model itself in Blender by 90 degrees and it's ok now, although AO still doesn't change the angle as it should. Now for the actual problem

3)The Pitch. No matter what, A_SetPitch or PitchOffset don't work. At all. The projectile is always flat.

I will post the relevant code below.

The Objective: To make the missile adjust angle and pitch constantly as it's moving.

However, I don't know how, or why pitching doesn't seem to work.



Modeldef:

Code: Select all

Model Meteor
{

Path "Models/Meteor"
Model 0 "meteor.md3"
scale 50 50 50
frameindex METE A 0 0
AngleOffset 90			//Does nothing

}
Decorate:

Code: Select all

ACTOR Meteor
{
	Radius 4
	Height 2
	Projectile
	Speed 30
    Damage (random (340, 350))
	DamageType Explosive
    MeleeDamage 0
	Scale 0.5
    Decal "Scorch"
	Projectile
	+MISSILE
    +NOGRAVITY
    +EXTREMEDEATH
    +BLOODSPLATTER 
	+THRUSPECIES
	+MTHRUSPECIES
	+SPECTRAL
	+SEEKERMISSILE
	SeeSound "weapons/RLL"
	DeathSound "Explosion"
	Obituary "$OB_MPROCKET"
	Species "Marines"
	States
	{
	Spawn:
	
		TNT1 A 0
		TNT1 A 1 A_PlaySound("PAC/PACFIR", 6, 1.0)
//		METE A 0 A_SetPitch (sin(momz)/cos(momx), 0, AAPTR_DEFAULT)
                METE A 0 A_SetPitch (-45, 0, AAPTR_DEFAULT)
//		METE A 0 A_SetAngle (90+Angle, 0, AAPTR_DEFAULT)
		METE A 1 BRIGHT A_CustomMissile("RocketBackblast", 0, 0, 180, 2, 0+pitch)
		METE A 1 Bright
		
		METE AAAAA 1 A_SpawnItem("RocketFlare",-20,0)
		METE AAAAA 1 A_SpawnItem ("OldschoolRocketSmokeTrail2")
		METE AAAAA 1 A_CustomMissile ("OldschoolRocketSmokeTrail2", 2, 0, random (160, 210), 2, random (-30, 30))
				
		Goto Seek
		
		Seek:
		TNT1 A 0
		
		METE AAAAAA 0 A_SpawnItem("RocketFlare",-20,0)
		METE AAAAAA 0 A_SpawnItem ("OldschoolRocketSmokeTrail2")
		METE AAAAAA 0 A_CustomMissile ("OldschoolRocketSmokeTrail2", 2, 0, random (160, 210), 2, random (-30, 30))
		METE A 0 A_PlaySound("PAC/PACMIS", 7, 1.0)

		Goto SMissile
				
		Smissile:
		TNT1 A 0 A_Tracer2
		METE A 0 A_FaceTracer(0, 0, 0, 0, FAF_TOP)
//		METE A 0 A_SetPitch (45-pitch, 0, AAPTR_DEFAULT)
		METE A 1 A_SeekerMissile(7, 11, SMF_PRECISE)
		METE A 0 A_SpawnItem("RocketFlare",-20,0)
		METE A 0 A_SpawnItem ("OldschoolRocketSmokeTrail2")
		METE A 0 A_CustomMissile ("OldschoolRocketSmokeTrail2", 2, 0, random (160, 210), 2, random (-30, 30))
		METE A 0 Bright A_ScaleVelocity(1.55)
		
		Loop
User avatar
R4L
Global Moderator
Posts: 419
Joined: Fri Mar 03, 2017 9:53 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Pro
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Help with 3d Projectile

Post by R4L »

I think you want PitchOffset.

Return to “Scripting”