Spawning an object with the player's angle?

Status
Not open for further replies.

Lat'

Absolute territory where
Kart Krew™️
Sorry if that sounds dumb, but I tried this

Code:
local chargedust1 = P_SpawnMobj(mo.x, mo.y, mo.z, MT_PARTICLE)
chargedust1.angle = mo.angle

(mo is player.mo)
But the object in question never spawns with the right angle, it always faces the same direction. How can I make it spawn with the player's angle?
 
It faces the direction it would face if its angle was 0, as this gif can tell (look at the player's angle.)

IllfatedAmbitiousFruitfly.gif


I also tried P_SPMAngle, with mo.angle as the angle value with the exact same result.
In case that matters too, here's the other things besides the angle setting:

Code:
		local chargedust1 =  P_SpawnMobj(mo.x, mo.y, mo.z, MT_PARTICLE)
		chargedust1.angle = mo.angle
		chargedust1.fuse = 10
		chargedust1.momx = -6*FRACUNIT
		chargedust1.momy = 3*FRACUNIT
		chargedust1.momz = 3*FRACUNIT
 
Setting momx/momy on an object doesn't adjust to the object's angle. Try P_Thrust(mobj, angle, speed) instead.
 
I just grabbed this from the wiki. Maybe this should help:

mobj_t P_SpawnPlayerMissile(mobj_t source, int type, [int flags2])
Functionally identical to P_SPMAngle, except with the missile's angle always being the source's angle, and the player's vertical aiming angle will always be used. This returns the Object spawned by the function.
 
Oh don't worry I found my way through it, it's just because I used momx and momy that are not adjusted to the angle of the player.
Also I was not willing to send a missile, this was for Sylveon's quickattack charging dust. (Like a spindash dust trail.)
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top