|
| 18 Aug 2017 09:06 AM |
Hello!
I was wondering what the math is behind this, basically, I need a brick to be stationary, but tilt to wherever the mouse's position is on that brick relative to it.
Example:
The mouse is hovering over the right side of the brick, the brick doesn't rotate to face the mouse but tilt's instead. If the player moves the mouse to the lower right, the brick tilts to the lower right with the upper left jutting out.
Any help with this is greatly appreciated! (If you could also explain what each section of the code does, that would be superb because I could then learn from it, thanks!!)
Sometimes, it's the people no one imagines anything of, who do the things that no one can imagine. |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2017 09:18 AM |
| So you basically want to map mouse movements to make the brick rotate similar to the way an airplane would move? |
|
|
| Report Abuse |
|
|
|
| 18 Aug 2017 09:31 AM |
If you mean leaving the brick stationary and having it tilt to simulate pressure based on where the mouse is on that brick, yes.
This is what I have right now:
Mouse.Move:Connect(function() if Mouse.Target and Mouse.Target == workspace.Part then workspace.Part.CFrame = CFrame.new(workspace.Part.Position, Mouse.Hit.p / 1.1) -- Dividing by 1.1 to minimalize the effect of the movement, works okay-ish, still not what I am looking for exactly.. end end)
Sometimes, it's the people no one imagines anything of, who do the things that no one can imagine. |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2017 09:13 PM |
B1
Sorry, still haven't found anything! :( |
|
|
| Report Abuse |
|
|
Preselect
|
  |
| Joined: 30 Jul 2017 |
| Total Posts: 94 |
|
|
| 23 Aug 2017 09:17 PM |
This might be what you're looking for, check it out:
http://wiki.roblox.com/index.php?title=API:Class/BodyAngularVelocity |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2017 09:53 PM |
Hm, I need the part to be anchored though. It cannot move it's position.
I'm not extremely well versed in body objects, so I might be wrong, but they need the part to be unanchored. |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2017 07:58 AM |
B2
Sometimes, it's the people no one imagines anything of, who do the things that no one can imagine. |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2017 08:54 AM |
Okay, so I have made a bit of progress and finally got it to look how I want...however, it does not respond properly.
Here's what I have:
workspace.ExotriumMainMenu.CFrame = CFrame.new(workspace.ExotriumMainMenu.Position) * CFrame.Angles(math.pi * (Mouse.Hit.p.X - workspace.ExotriumMainMenu.Position.X) / 75 *, math.pi * (Mouse.Hit.p.Y - workspace.ExotriumMainMenu.Position.Y) / 50, math.pi * (Mouse.Hit.p.Z - workspace.ExotriumMainMenu.Position.Z) / 75 * -1)
If you put your mouse over the lower left part of the brick and drag it up to the upper left, it responds perfectly. Any other place is completely off.
Could someone help me fix that CFrame above, please? Thanks! :D
Sometimes, it's the people no one imagines anything of, who do the things that no one can imagine. |
|
|
| Report Abuse |
|
|
|
| 24 Aug 2017 11:59 AM |
B3
Anyone? Even a pointer would be nice..
Sometimes, it's the people no one imagines anything of, who do the things that no one can imagine. |
|
|
| Report Abuse |
|
|