|
| 03 Sep 2015 06:32 PM |
I need to get a brick to turn on its Y axis but in the direction of the camera how do i do this?
Do you want to learn how to script? Come check out my tutorials on YouTube! https://m.youtube.com/channel/UCZN_TRuPA8hQhRjJvA-G4pg make sure to subscribe and like if I was any help! |
|
|
| Report Abuse |
|
|
East98
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 418 |
|
|
| 03 Sep 2015 06:36 PM |
| Where is the part? Do you mean its somewhere in the distance looking at the camera or it is at the same position as the camera just rotated so that the top surface of the part is facing the same direction? |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2015 06:38 PM |
The part is the camera subject the camera faces it just like it would with a normal character
Do you want to learn how to script? Come check out my tutorials on YouTube! https://m.youtube.com/channel/UCZN_TRuPA8hQhRjJvA-G4pg make sure to subscribe and like if I was any help! |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2015 06:48 PM |
Anyone!?
Do you want to learn how to script? Come check out my tutorials on YouTube! https://m.youtube.com/channel/UCZN_TRuPA8hQhRjJvA-G4pg make sure to subscribe and like if I was any help! |
|
|
| Report Abuse |
|
|
East98
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 418 |
|
|
| 03 Sep 2015 06:49 PM |
| You really need to change your sig... |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2015 06:54 PM |
why? u dont think i can script cuz I dont work with this kind of thing much?
Do you want to learn how to script? Come check out my tutorials on YouTube! https://m.youtube.com/channel/UCZN_TRuPA8hQhRjJvA-G4pg make sure to subscribe and like if I was any help! |
|
|
| Report Abuse |
|
|
East98
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 418 |
|
|
| 03 Sep 2015 07:00 PM |
| "This kinda thing" Yeah i dont think you work with scripting that much. Haha ill help you anyways. Could you please explain a little bit more in detail where this part is and what you want it to do? |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2015 07:07 PM |
I work with scripting a lot more than u think look at this game I scripted all of it http://www.roblox.com/games/282763164/Clash-of-Bloxians-Beta and btw this part is just an example I really made a character that has joints like elbows and knees and stuff i can Get it to face the camera but i only want it to face on the cameras X axis because the character goes in the direction of its look Vector so if I am looking up in the sky it will go flying into the sky I dont want its body to face up I only want it to turn on its Y axis
Do you want to learn how to script? Come check out my tutorials on YouTube! https://m.youtube.com/channel/UCZN_TRuPA8hQhRjJvA-G4pg make sure to subscribe and like if I was any help! |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2015 07:10 PM |
There is always something that a programmer doesn't know how to do just like there is alwayse someone better than you at something
Do you want to learn how to script? Come check out my tutorials on YouTube! https://m.youtube.com/channel/UCZN_TRuPA8hQhRjJvA-G4pg make sure to thumbs up and subscribe if I was any help! |
|
|
| Report Abuse |
|
|
East98
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 418 |
|
|
| 03 Sep 2015 07:23 PM |
Ok well that makes it a lot more complicated because im assuming the part is the head and is welded to the rest of the body. You will need to do something along the lines of convert the position of where the camera is facing to ObjectCoordinates of the Torso. Then change the C0 and C1 values of the neck joint. And by the way congrats on your game! Heres mine i did all by myself:
http://www.roblox.com/games/253147308/Shockwave-Pre-Alpha |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2015 07:24 PM |
| CFrame.new(where its at,what it looks at) |
|
|
| Report Abuse |
|
|
East98
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 418 |
|
|
| 03 Sep 2015 07:26 PM |
Its not that simple because the part is welded to another part (Assuming its the torso). This page should be able to help you:
http://wiki.roblox.com/index.php?title=Cframe |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2015 07:31 PM |
I'm not trying to make the head face the camera I want the entire body to face the camera but I only want the Y axis to change so that way the body will not be facing straight up btw I'm using a bodygyro to change the rotation
Do you want to learn how to script? Come check out my tutorials on YouTube! https://m.youtube.com/channel/UCZN_TRuPA8hQhRjJvA-G4pg make sure to thumbs up and subscribe if I was any help! |
|
|
| Report Abuse |
|
|
|
| 03 Sep 2015 07:35 PM |
--local script in backpack/startergui
game:GetService("RunService"):BindToRenderStep("HeadRotate",1,function() if player.Character then local torso,head = player.Character:FindFirstChild("Torso"),player.Character:FindFirstChild("Head") if torso and head then local neck = torso:FindFirstChild("Neck") local targget = (Workspace.CurrentCamera.CoordinateFrame * CFrame.new(0,0,-100)).p --mouse.Hit.p local dir = (targget-torso.Position-Vector3.new(0,0.5,0)).unit local angle = math.asin(-dir.y) if neck then neck.C0 = CFrame.new(0,1.5,0) neck.C1 = CFrame.Angles(angle,0,0) end end end end) |
|
|
| Report Abuse |
|
|
| |
|