|
| 04 Feb 2017 07:17 AM |
Okay, so please bear with me. I need to enable a player to move an object (model) around with the mouse alone a grid, but I'm not sure how to go about this. I can't seem to get the mouse's 3d position, outside of mouse.Hit.p for obvious reason. I would really appreciate all help if any. Please explain with details, thanks.
I was about to make a model elevator by using SetPrimaryPartCFrame, will this work along those lines are is there another method to moves model frame by frame.
Also is there a more effient way to make an elevator?
Thanks! |
|
|
| Report Abuse |
|
|
IVgormYT
|
  |
| Joined: 24 Aug 2016 |
| Total Posts: 485 |
|
|
| 04 Feb 2017 07:22 AM |
Hello! To move a model with your mouse, select the selecter and drag the model to where you want it!
I hope i was to help :) |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 07:22 AM |
whats wrong with mouse.Hit.p?
if you mean the model blocks the mouses position from registering the part/baseplate underneath, use mouse.TargetFilter and set it to the model
|
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 07:50 AM |
| I guess I should have mentioned, I have also been unable to drag a single part. Mouse.Hit.p DOES move the part, but only to the point of the mouse, which will always be somewhere on the part, given I have to select the part. Guess Im asking someone to explain a drag tool to me. TargetFilter prevent all selection of said parts, so Im not sure how that could be the answer, but I did try it and results were as expected. :( But thanks. |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 07:53 AM |
@IVgormYT
I meant in game. I want to be able to drag models in games.😢
|
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 07:53 AM |
what do you mean about target filter?
|
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 08:05 AM |
| It ignores any brick set within it, I misread your first reply. |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 08:05 AM |
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local uis = game:GetService("UserInputService")
uis.InputChanged:connect(function(input, event) if event then return end if input.UserInputType == Enum.UserInputType.MouseMovement then print(mouse.Hit.p) script.Parent:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p) end end |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 08:06 AM |
| script.Parent:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p)) * |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 08:21 AM |
That script didn't work, I placed it in a local script within starter player scripts. Thanks though. The most important thing I value is understanding how this can be accomplished. Can you explain to me in detail how this script was meant to work. I understand most of it honestly, but I'm very loosely farmiliar with the UIS. If you'd be so kind to give me just a bit of in sight on this, I'd be very greatful. 🙏🙏🙏🙏🙏🙏
|
|
|
| Report Abuse |
|
|
| |
|
|
| 04 Feb 2017 08:56 AM |
Bump two.
Im not even sure what bumps are suppose to do, but Ive seen people use them when their post haven't been answered. |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 08:58 AM |
basically moves the thread to the top of the page
|
|
|
| Report Abuse |
|
|
VVired
|
  |
| Joined: 26 May 2014 |
| Total Posts: 590 |
|
|
| 04 Feb 2017 08:59 AM |
| ^^ they bump the thread to the top so people can see them. |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 09:14 AM |
| Oh, thanks for informing! So, can I get a little help. 😥😥😥 |
|
|
| Report Abuse |
|
|
| |
|
Voydex
|
  |
| Joined: 26 Oct 2014 |
| Total Posts: 272 |
|
|
| 04 Feb 2017 10:26 AM |
Ok so use Model:SetPrimaryPart(ARAndOMPartInThModel)
Now use Model.PrimaryPart.CFrame = game.Players.LocalPlayer:GetMouse().Target
I think that should work. |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2017 11:19 PM |
That formula won't allow me to drag a part or model, but it will teleport that model to the location of the object I clicked. But thanks.
Bump. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Exus100
|
  |
| Joined: 11 Aug 2007 |
| Total Posts: 351 |
|
|
| 05 Feb 2017 06:25 AM |
that one guys script was meant to be placed inside a part, not playerscripts.
|
|
|
| Report Abuse |
|
|
Exus100
|
  |
| Joined: 11 Aug 2007 |
| Total Posts: 351 |
|
|
| 05 Feb 2017 06:40 AM |
local UserInputService = game:GetService("UserInputService") local player = game.Players.LocalPlayer local mouse = player:GetMouse() local mouseDown = true local selected = nil local selectableModel = workspace:WaitForChild("MyModel")
UserInputService.InputChanged:connect(function(input, event)
if input.UserInputType ==##num.UserInputType.MouseMovement then if (selected ~= nil) then if (selected.PrimaryPart ~= nil) then local mouseRay = Ray.new(mouse.UnitRay.Origin, mouse.UnitRay.Direction * 200) local part, hit = workspace:FindPartOnRayWithIgnoreList(mouseRay, {selected}) selected:SetPrimaryPartCFrame(CFrame.new(hit)) else print("No primary part set!") end else print("Nothing selected!") end end end)
UserInputService.InputBegan:connect(function(input, event) if input.UserInputType == Enum.UserInputType.MouseButton1 then mouseDown = true if (mouse.Target ~= nil and mouse.Target:IsDescendantOf(selectableModel)) then selected = selectableModel end end end)
UserInputService.InputEnded:connect(function(input, event) if input.UserInputType == Enum.UserInputType.MouseButton1 then mouseDown = false selected = nil end end)
|
|
|
| Report Abuse |
|
|
Exus100
|
  |
| Joined: 11 Aug 2007 |
| Total Posts: 351 |
|
| |
|
Naco88
|
  |
| Joined: 30 Oct 2009 |
| Total Posts: 665 |
|
| |
|