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
 

How would I convert CFrame to Vector3

Previous Thread :: Next Thread 
guagiguagua is not online. guagiguagua
Joined: 15 Dec 2016
Total Posts: 206
16 Sep 2017 11:28 AM
Ok this sounds wierd, but I do not know what the heck I'm supposed to do, CFrame- A Position and An Orientation inherited from basepart. game.Players.LocalPlayers:getMouse().hit always returns CFrame, and I want to convert that CFrame into a position? And also, Vector3 is the value type for position and orientation, how am I supposed to select the position of or the orientation of from CFrame.new(Vector3)?

--script--
mouse = game.Players.LocalPlayers:getMouse()
local part = Instance.new("Part")

function getMousePOSITION()
part.CFrame = mouse.HIt --this is my problem, this is a CFrame and then i want the position from mouse.hit
end


mouse.Move:connect(getMousePOSITION)
Report Abuse
KapKing47 is not online. KapKing47
Joined: 09 Sep 2012
Total Posts: 5522
16 Sep 2017 11:29 AM
CFrame.p is the position.


Report Abuse
guagiguagua is not online. guagiguagua
Joined: 15 Dec 2016
Total Posts: 206
16 Sep 2017 11:35 AM
You gotta be kidding me.
Report Abuse
guagiguagua is not online. guagiguagua
Joined: 15 Dec 2016
Total Posts: 206
16 Sep 2017 11:40 AM
Thanks but this is my full thing, if i want to make building tools,

mouse = game.Players.LocalPlayer:getMouse()
script.Parent.Activated:connect(function()
mouse.TargetFilter = nil
local part = Instance.new("Part")
part.Size = Vector3.new(5, 5, 5)
part.Parent = workspace
part.Position = mouse.hit.p --Look over here
part.Anchored = true
end)

This make a block over at my mouse position but, anywhere i press, it will place the block on top of mouse.Target which is very annoying, cause its not CFrame
Report Abuse
KapKing47 is not online. KapKing47
Joined: 09 Sep 2012
Total Posts: 5522
16 Sep 2017 11:51 AM
Ah, u want to keep the rotation of the part but also the position of the mouse?

local function merge(cf, v3)
return (cf - cf.p) + v3
end

then

part.CFrame = merge(part.CFrame, mouse.Hit.p) --Change part.CFrame to a CFrame of which rotation u want to keep


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