My script is as follows...
-- Set Function
local Rocket = Instance.new('Part') do
-- Set up the rocket part
Rocket.Name = 'Rocket'
Rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
Rocket.Size = ROCKET_PART_SIZE
Rocket.Orientation = CFrame.Angles.new(0,0,math.rad(180))
Rocket.CanCollide = false
-- Add the mesh
local mesh = Instance.new('SpecialMesh', Rocket)
mesh.MeshId = MISSILE_MESH_ID
mesh.Scale = MISSILE_MESH_SCALE
-- Add a force to counteract gravity
local bodyForce = Instance.new('BodyForce', Rocket)
bodyForce.Name = 'Antigravity'
bodyForce.force = Vector3.new(0, Rocket:GetMass() * GRAVITY_ACCELERATION, 0)
When the script is executed the projectile is fired backwards out of the Rocket Launcher. I know that in order to determine the Rotation I put
Rocket.Orientation = Vector3.new(???,??? * ???, ???) -- This is where I encounter problems.
Thanks for your consideration!
The Bottom Line: How to call rotation functions and how to determine rotation using Vector3.
Thanks
EDIT
Ok SO basically I have added the CFrame to the Projectile, but the mesh itself will not rotate. I cannot figure out how to change it
Here is the script:
-- Create a clone of Rocket and set its color
local rocketClone = Rocket:Clone()
--game.Debris:AddItem(rocketClone, 30)
rocketClone.BrickColor = player.TeamColor
rocketClone.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent ~= player.Character and hit.Parent ~= tool then
rocketClone:Destroy()
end
end)
spawn(function()
wait(30)
if rocketClone then rocketClone:Destroy() end
end)
-- Position the rocket clone and launch!
local spawnPosition = (tool.Handle.CFrame * CFrame.new(2, 0, 0)).p
rocketClone.CFrame = CFrame.new(spawnPosition, target)* CFrame.Angles(0 ,0 ,0) --NOTE: This must be done before assigning Parent
rocketClone.Velocity = rocketClone.CFrame.lookVector * ROCKET_SPEED --NOTE: This should be done before assigning Parent
rocketClone.Parent = game.Workspace
-- Attach creator tags to the rocket early on
local creatorTag = Instance.new('ObjectValue', rocketClone)
creatorTag.Value = player
creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
local iconTag = Instance.new('StringValue', creatorTag)
iconTag.Value = tool.TextureId
iconTag.Name = 'icon'
delay(attackCooldown, function()
canFire = true

17 comments
You should use CFrame to set the parts position and rotation
How would I go about doing that?
as orientation takes into account collisions
Cframe.Angles
https://developer.roblox.com/api-reference/datatype/CFrame
I have looked at this article. What would I put here --> "CFrame rotation = CFrame.new(--->)
Maybe (Rocket.x,Rocket.y*180,Rocket.z)
Change the position.
keep in mind that CFrame.Angles and the fromeuleangles functions all use radians , not degrees
Hmm ok
How do I set radians? Sorry
CFrame.Angles(math.rad(),0,0) use math.rad(90) for rotation in radians
CFrame.Angles(math.rad(),0,0) use math.rad(90) for rotation in radians
Cool Thanks for the help... I'll reply after I attempt to rotate the mesh
@ExHydraboy can you also edit your question to include the attempt.
Definitely
Updated