|
| 26 May 2017 03:15 PM |
w.C0 = CFrame.Angles(0, math.rad(game.Workspace.Camera2.CoordinateFrame.lookVector.Y * 1000), 0)
This partly works, but its a bit iffy, camera2 is what I named the players camera in test mode. Could someone fix this up a bit to make it aim where the camera is looking? |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 03:17 PM |
| Meant to use .Z, ignore the .Y |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 03:19 PM |
local pivotPos = (weld.Part1.CFrame * weld.C1).p weld.C0 = weld.Part0.CFrame:toObjectSpace(camera.CFrame - camera.CFrame.p + pivotPos) |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 03:19 PM |
| also dont rename the camera and instead use CurrentCamera |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 03:22 PM |
| the toObjectSpace turns it into an offset based on part0 to make sure that the pivot stays in the right place and that it goes to the right angle |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 03:23 PM |
| You can rename the camera and it won't have any effect. You should use CurrentCamera btw. |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 03:26 PM |
if u want it to face the camera however then
CFrame.new(pivotPos,camera.CFrame.p)
inside the toObjectSpace part |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 03:36 PM |
| while wait() do local pivotPos = ############### # ####### w.C0 = w.Part0.CFrame:toObjectSpace(CFrame.new(pivotPos,game.Workspace.Camera.CFrame.p)) end causes it to spin rapidly out of control in some spots, or keeps it spinning constantly. I want it to only spin on the Z axis(in vector terms), so it doesn't spin up/down or diagonally. |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 03:41 PM |
| well u can do it without using pivots CFrame and instead using the objects CFrame but then it will move the pivot back to the origin |
|
|
| Report Abuse |
|
|
| |
|
|
| 26 May 2017 05:10 PM |
can you give an example?
w.C0 = w.Part0.CFrame:toObjectSpace(CFrame.new(p.Position,game.Workspace.Camera.CFrame.p)) makes it spin places I don't want it to and allows for a constant spin, rather than a controlled object pointing at camera loop like SwordBurst Online has.
|
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:14 PM |
| w.C0 = w.Part0.CFrame:toObjectSpace(CFrame.new(w.Part0.CFrame.p,workspace.CurrentCamera.CFrame.p)) |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:18 PM |
That still causing spinning when the camera isn't moving and allows it to rotate on all vertices still.
|
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:18 PM |
| then dont use welds????? .-. |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:20 PM |
How can I have a part be 'attached' to a player and not use welds? Last time I made a thread asking for an alternative to a loop + cframe and bodymovers they all said 'weld'.
Cus the HP bar is welded to the players humanoidrootpart |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:21 PM |
try to use align position then i guess it works relatively the same as weld except is free to cframe and moves based on its attachment |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:22 PM |
besides u need to have a client sided and server sided version if ur trying to make an hp bar, why does it need to be 3d??? use a billboard gui instead as it automatically does this camera rotation thing |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:27 PM |
| Isn't there a way to do this with welds? Swordburst had this before constraints |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:28 PM |
| swordburst probably cframes it locally |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:28 PM |
I'm not trying to do a billboard gui, I already had been using that until I converted to 3d. The 3d makes it pop and look better overall (atleast to me), whereas guis aren't as aesthetic, being 2d.
|
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:29 PM |
| i mean since ur always constantly setting the cframe anyways |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:30 PM |
Well if I removed the weld and then did the constantly updating cframe, the part would 'drag' behind because it wouldn't keep up in the same time-space as the character, making a flicker effect and visible dragging.
|
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:32 PM |
game:getService("RunService"):BindToRenderStep("hpBar",201,function() thing.CFrame = camera.CFrame - camera.CFrame.p + head.CFrame.p + Vector3.new(0,2,0) end) |
|
|
| Report Abuse |
|
|
|
| 26 May 2017 05:37 PM |
| if u just want the left-right rotation then u need to pull that out of the lookVector via inverse tangent |
|
|
| Report Abuse |
|
|
| |
|