Rotate spell GFX for the player

I’m attempting to make my first good looking spell using GFX, and I’m starting out with a simple shockwave punch. The issue here is that I’m not sure how I would get the shockwave to face the character instead of having an orientation that faces the ground. I’ve tried rotating it 90 degrees but this just faces it specifically one way. What kind of math would I need to do to get the shockwave to rotate 90 degrees and still face relative to the player?

Here’s my sample code so far:

local function shockwaveCasted(plr)
	local char = plr.Character
	local root = char.HumanoidRootPart
	
	local fx = workspace.shockwave:Clone()
	fx.Parent = workspace
	fx.wave1.CFrame = root.CFrame * CFrame.new(0,0,3)
	fx.wave1.Rotation = root.CFrame.LookVector * Vector3.new(90,0,0)
end

Radians.

local Offset = CFrame.new(0,0,3) 
local Rotation = CFrame.Angles(math.pi/2, 0, 0)

fx.wave1.CFrame = root.CFrame * Offset * Rotation

Alternatively, instead of doing math.pi/2, you can just do math.rad(90), and if it faces towards the ground, try another axis.

Thanks, I’ve never actually done much math on the platform, so knowing this tool for future reference is going to help greatly! I’ll be looking into Radians more!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.