| |
|
| |
|
|
| 05 Mar 2016 06:05 PM |
Title is either: >to vague or make's no sense.
|
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 06:11 PM |
| We help scripters here. We do not make scripts. |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 06:20 PM |
Then, please, give me the information to make one.
|
|
|
| Report Abuse |
|
|
Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 05 Mar 2016 06:22 PM |
It's not hard to understand what he's asking for.
|
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 06:25 PM |
Hello.
I suppose that an algorithm based around manipulation of the facing vector CFrame property may be able to help you.
Here is a link to all of the CFrame object properties, from the ROBLOX Wiki:
http://wiki.roblox.com/index.php?title=CFrame&redirect=no#Properties
Farewell. |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 06:26 PM |
@wack So if you want it visible to yourself, make a SurfaceGui that dispeares when somebody else looks at it, but not you, and if you dont care, make a brick position to where you are pointing. |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 06:29 PM |
How does one make a brick position using mouse? I'm sorry, but I'm not experienced in the aspects of the mouse.
|
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 06:30 PM |
@wacky Read the wiki. It is a lot easier if you make it so there are many bricks, but if you want it to follow the cursor, that can not be made in 1 day or any time i have to quick forum |
|
|
| Report Abuse |
|
|
Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 05 Mar 2016 06:36 PM |
Put this into a localscript inside StarterGui:
p = game.Players.LocalPlayer m = p:GetMouse() rs = game:GetService("RunService") newGyro = Instance.new("BodyGyro", p.Character.Torso)
rs.RenderStepped:connect(function() newGyro.CFrame = CFrame.new(p.Character.Torso.Position, m.Hit.p) newGyro.MaxTorque = Vector3.new(0, 30000, 0) newGyro.P = 30000 end)
|
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 06:37 PM |
@base A young scripter will never learn if you give them the scripts. |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 05 Mar 2016 08:06 PM |
local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse() local character = player.Character or player.CharacterAdded:wait() local neck = character:WaitForChild("Torso"):WaitForChild("Neck") game:GetService("RunService").RenderStepped:connect(function(step) neck.C0 = CFrame.new(0,1,0) local hit = mouse.Hit.p local P0C0 = (neck.Part0.CFrame*neck.C0) local c = hit - P0C0.p neck.C1 = CFrame.new( (CFrame.new(P0C0.p, hit)*CFrame.Angles(math.acos(.5/c.magnitude),0,0)).lookVector*.5 + P0C0.p, hit ):inverse()*P0C0 end) |
|
|
| Report Abuse |
|
|
Flarebitz
|
  |
| Joined: 29 Dec 2011 |
| Total Posts: 131 |
|
|
| 05 Mar 2016 08:13 PM |
Put this in playerscripts -writing this on kindle-.
local mousePoint = game.Players.LocalPlayers:GetMouse().hit local char = game.Players.LocalPlayers.Character
while wait() do char.Neck.C0 = CFrame.Angles(char.Head.Position,mousePoint.p) end |
|
|
| Report Abuse |
|
|
Flarebitz
|
  |
| Joined: 29 Dec 2011 |
| Total Posts: 131 |
|
|
| 05 Mar 2016 08:14 PM |
| @Casual pls teach me. I don't know much bout maths. |
|
|
| Report Abuse |
|
|
Baseness
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 05 Mar 2016 08:27 PM |
Casualist's script is epic
|
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 08:28 PM |
| BodyGyro works but also is pointless (personal) you can use simpler things that work better but good start tbh. |
|
|
| Report Abuse |
|
|
| |
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 05 Mar 2016 08:50 PM |
@Flare I use a little bit of trig to calculate the position of the Head and use CFrame constructors to get the correct rotation. You could approach this with linear algebra, but I figured more people would be able to understand what I'm doing here if I use trig.
Basically here's what's going on. I want neck.C0 to equal CFrame.new(0,1,0). This is to say, I want the base of the neck, where the rotation happens to occur at torso.CFrame*CFrame.new(0,1,0). This value is P0C0 in my script.
For welds, weld.Part0.CFrame*weld.C0 == weld.Part1.CFrame*weld.C1 LHS (left hand side, is P0C0). RHS are our unknowns. Ultimately, we want to solve for weld.C1, so me must figure out weld.Part1.CFrame
Since we know the final lookvector for the Head is perpendicular to it's displacement from the neck base (this is where the hard coded 0.5 comes from), we can form a right triangle between P0C0.p, hit, and the Head's final position.
Knowing the length of two sides, the hard coded .5 (displacement from neck base, P0C0, to the Head's final position) and c == P0C0.p - hit we can solve for the angle between displacement vector and c. Leveraging the fact that the local x axis is the normal vector for the plane containing P0C0.p and hit if we use the CFrame constructor CFrame.new(P0C0.p, hit), we can rotate the lookvector of this CFrame (which is c.unit) by the angle math.asin(.5/c.magnitude) to get the displacement vector.
Since the magnitude of displacement is .5, we can finally get the global position of the Head, which is .5 studs from P0C0: (previous steps).lookVector*.5 + P0C0.
Using the CFrame constructor CFrame.new((previous steps).lookVector*.5 + P0C0, hit) gives us the position and rotation we want, so now we just have to fix C1.
weld.Part1.CFrame:inverse()*weld.Part0.CFrame*weld.C0 == weld.Part1.CFrame:inverse()*weld.Part1.CFrame*weld.C1
weld.Part1.CFrame:inverse()*weld.Part0.CFrame*weld.C0 ==weld.C1
and this explains my use of :inverse()*P0C0 |
|
|
| Report Abuse |
|
|
Flarebitz
|
  |
| Joined: 29 Dec 2011 |
| Total Posts: 131 |
|
|
| 05 Mar 2016 09:23 PM |
| Sorry but I got lost around the introduction of the lookVector property. Also inverse method. Can you please explain those two. As far as I know lookVector returns the unit vector of the front face. But I don't really know how it looks/ how you can manipulate. |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 05 Mar 2016 09:37 PM |
First, let's tackle inverse. Generally when you do something, there is a way to undo it (not always).
For example, we know that 3*x = 15.
To find out what x is, we invert the operation. The inverse of multiplication is division, so if we apply inverse the operation (multiplying x by 3), we can isolate x.
(3*x)/3 == 15/3 x == 5
So for the equaition CFrameA*CFrameX == CFrameC, if we want to isolate CFrameX, we have to invert the transformation cased by CFrameA. To do this, we multiply each side by the inverse of CFrameA
CFrameA:inverse()*CFrameA*CFrameX = CFrameA:inverse()*CFrameX
CFrameX = CFrameA:inverse()*CFrameX
As for the lookVector, here is a decent visual: http://wiki.roblox.com/index.php?title=CFrame#Rotation_Matrix |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2016 09:49 PM |
@Casualist Where do you define p at??
|
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 05 Mar 2016 09:51 PM |
The positional component of a CFrame is retrived by indexing p
print(CFrame.new(0,10,1)) --// prints 12 numbers, position and rotation matrix print(CFrame.new(0,10,1).p) --// just prints position |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Mar 2016 10:17 PM |
| my god, would you tutor this stuff :P @Casualist |
|
|
| Report Abuse |
|
|