|
| 30 Jan 2017 08:30 PM |
So if I created the following weld..
arrow = game.ReplicatedStorage.Arrow:Clone()
arrow.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -5) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(90))
local Joint = Instance.new("Weld") Joint.Part0 = arrow Joint.C0 = arrow.CFrame:inverse() Joint.Part1 = character.HumanoidRootPart Joint.C1 = character.HumanoidRootPart.CFrame:inverse()
Joint.Parent = character.HumanoidRootPart arrow.Parent = character
-- How would I rotate it on its x axis right here |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Jan 2017 08:37 PM |
Directory.Object.Rotation = Vector3.new(val,val,val)
"Got my cup of Coffee" |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 08:40 PM |
How do i do this with CFrames? While also keeping it attached to character, and not rotating character. |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 08:43 PM |
uhm i think the joint would break if you tried to rotate it.
"Got my cup of Coffee" |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 08:47 PM |
Well, it is possible to do this so how to do it? |
|
|
| Report Abuse |
|
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 30 Jan 2017 08:52 PM |
thing.CFrame = thing.CFrame * CFrame.Angles(x,0,0)
|
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 08:55 PM |
Good try Time although that rotates character... |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
|
| 30 Jan 2017 08:59 PM |
Since its a weld you want to CFrame that:
local X = math.min((tick() - t0) / 1, 1) * 120 --t0 is tick() before the loop
welds[1].C1 = welds[1].C1:lerp(PF1, (X / 90)) --Bad example but its what I use. |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 09:01 PM |
Any other examples please..
Time since I want it to be attached to character? |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 09:05 PM |
| Nvm got your example to work thanks Lua! |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Jan 2017 09:26 PM |
Still can't get this to work :(
Want the arrow to rotate and point towards the followPoint position.
=================================================================================
Player = game.Players.LocalPlayer character = Player.Character arrow = game.ReplicatedStorage.Arrow:Clone()
arrow.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -5) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(90))
local Joint = Instance.new("Weld") Joint.Part0 = arrow Joint.C0 = arrow.CFrame:inverse() Joint.Part1 = character.HumanoidRootPart Joint.C1 = character.HumanoidRootPart.CFrame:inverse()
Joint.Parent = character.HumanoidRootPart arrow.Parent = character
while wait() do local PointingPos = game.Workspace.followPoint.Position local ArrowPos = Vector3.new(0, 0, 5) Joint.C0 = CFrame.new(PointingPos, ArrowPos) * Joint.C1 * CFrame.new(0, 0, 5) end
|
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 09:31 PM |
Can't get the cframe matrix right.. |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 09:40 PM |
Some one help please, this is really frustrating me... |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 09:52 PM |
| ahhh have been trying for 20 min now. |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 10:59 PM |
change this
Joint.C0=arrow.CFrame:inverse()*character.HumanoidRootPart.CFrame:inverse() --remove Joint.C1
local i=0 while true do joint.C1=CFrame.Angles(0,math.rad(i%360),0) i=i+1 wait() end
--should spin it on its x if its perfectly upright
|
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 10:03 AM |
cool I was already able to spin it correctly, just not able to point it in a certain direction using the CFrame.new(Vector3, Vector3). |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 10:10 AM |
The method I already created works just fine for spinning in pre-calculated ways. I just need to know how to point the arrow at objects.
---------------------------------------------------------------------------------------
wait(0.1)
Player = game.Players.LocalPlayer character = Player.Character arrow = game.ReplicatedStorage.Arrow:Clone()
arrow.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -5) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(90))
local Joint = Instance.new("Weld") Joint.Part0 = arrow Joint.C0 = arrow.CFrame:inverse() Joint.Part1 = character.HumanoidRootPart Joint.C1 = character.HumanoidRootPart.CFrame:inverse()
Joint.Parent = character.HumanoidRootPart arrow.Parent = character
game:GetService("RunService").RenderStepped:connect(function() arrow.LocalTransparencyModifier = 0 end)
-- Replace what is bellow to make the arrow point towards a part in game called "Point".
i = 1 while wait() do i = i + 1 Joint.C0 = CFrame.Angles(0, 0, math.rad(i)) * Joint.C1 * CFrame.new(0, 0, 5) end |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 10:23 AM |
I feel like what I am trying to solve here is fairly simple... |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 10:37 AM |
-- Replace what is bellow to make the arrow point towards a part in game called "Point".
i = 1 while wait() do i = i + 1 Joint.C0 = CFrame.Angles(0, 0, math.rad(i)) * Joint.C1 * CFrame.new(0, 0, 5) end
-- k
local point = POINT PART.Position
while wait() do Joint.C0 = CFrame.new(Joint.C0.p, point) end
let me know if that works, it might not point correctly in which case you'll probably need to use toWorldSpace |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2017 10:51 AM |
Did not seem to work sadly, just made it offset by like 1000 studs bellow and away.
wait(0.1)
Player = game.Players.LocalPlayer character = Player.Character arrow = game.ReplicatedStorage.Arrow:Clone()
arrow.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -5) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(90))
local Joint = Instance.new("Weld") Joint.Part0 = arrow Joint.C0 = arrow.CFrame:inverse() Joint.Part1 = character.HumanoidRootPart Joint.C1 = character.HumanoidRootPart.CFrame:inverse()
Joint.Parent = character.HumanoidRootPart arrow.Parent = character
game:GetService("RunService").RenderStepped:connect(function() arrow.LocalTransparencyModifier = 0 end)
while wait() do Joint.C0 = CFrame.new(Joint.C0.p, game.Workspace.Point.Position) end |
|
|
| Report Abuse |
|
|
RogueMage
|
  |
| Joined: 28 Jan 2012 |
| Total Posts: 1235 |
|
|
| 31 Jan 2017 10:56 AM |
| Try changing Part1 and Part0 around. |
|
|
| Report Abuse |
|
|