Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

What does the "CFrame.p" do in the code bits in the tutorial below?

Asked by 4 years ago
Edited 4 years ago

Hi all!

Just found this tutorial on the official developer wiki and it mentions the "p" property of CFrame. Couldn't find a "p" property in the documentation of CFrame so asking for some quick help here.

From https://developer.roblox.com/en-us/articles/Making-a-ray-casting-laser-gun-in-Roblox:

Raycasting

Now that we’ve got our framework set up, let’s get started on casting a ray. Add this to your mouse down function:

local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - toolHandle.CFrame.p).unit * 300)
  

This will create a ray that starts at the center of the tool’s handle

(tool.Handle.CFrame.p)
  

and goes out 300 studs towards the mouse’s position

 ((mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
  
0
.p is pretty much CFrame but in Vector3 form, so for example, CFrame.new(1, 2, 3).p = Vector3.new(1, 2, 3). The reason you can't find it in the documentation is because (I believe) it's deprecated. Use CFrame.Position instead. User#20279 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

It convert CFrame's position into vector3 data type position

Ad

Answer this question