generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Part aims toward camera?

Previous Thread :: Next Thread 
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
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
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
26 May 2017 03:17 PM
Meant to use .Z, ignore the .Y
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
26 May 2017 03:19 PM
also dont rename the camera and instead use CurrentCamera
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
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
chexyalani is online. chexyalani
Joined: 26 Mar 2017
Total Posts: 694
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
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
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
26 May 2017 03:41 PM
the center of part0*
Report Abuse
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
26 May 2017 05:14 PM
w.C0 = w.Part0.CFrame:toObjectSpace(CFrame.new(w.Part0.CFrame.p,workspace.CurrentCamera.CFrame.p))
Report Abuse
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
26 May 2017 05:18 PM
then dont use welds????? .-.
Report Abuse
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
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
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
26 May 2017 05:27 PM
Isn't there a way to do this with welds? Swordburst had this before constraints
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
26 May 2017 05:28 PM
swordburst probably cframes it locally
Report Abuse
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
26 May 2017 05:29 PM
i mean since ur always constantly setting the cframe anyways
Report Abuse
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
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
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
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
CrixusOdalisManiatus is online. CrixusOdalisManiatus
Joined: 16 Jun 2011
Total Posts: 5987
26 May 2017 05:45 PM
Ok, thanks.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image