ss1122
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|
|
| 28 Aug 2011 06:46 AM |
--i know barely anything about cframe, so i am most likely wrong
x = torso.CFrame:toObjectSpace(rocket.CFrame).X if x > 0 then --idk, it's on the right or something else --left i think end
.:Like a boss:. |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 28 Aug 2011 06:46 AM |
Are you looking for which side the rocket will be on, or which side it is currently on, or whether it is moving left or right?
For the second case:
local rocketCF, torsoCF = ...
local relativeCF = torsoCF:toObjectSpace(rocketCF) local sidewaysness = relativeCF.p.x
local side = sidewaysness < 0 and "left" or "right" |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 28 Aug 2011 06:47 AM |
> --i know barely anything about cframe, so i am most likely wrong > > x = torso.CFrame:toObjectSpace(rocket.CFrame).X > if x > 0 then > --idk, it's on the right or something > else > --left i think > end > > .:Like a boss:.
Darn, beat me to it |
|
|
| Report Abuse |
|
|
ss1122
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|
ss1122
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|
|
| 28 Aug 2011 06:59 AM |
--for the first case (i know this is a latepost, but i did it already so i'm posting it >:o)
local rocketcf, torsocf = ? local ray = Ray.new(rocketcf.p, rocketcf.lookVector*(torsocf.p-rocketcf.p).magnitude) local point = ray:ClosestPoint(torsocf.p) local newcf = CFrame.new(point) * (rocketcf - rocketcf.p) local x = torsocf:toObjectSpace(newcf).X if x > 0 then --right else --left (or it could be right at the same x as the torso) end
--? :D
.:Like a boss:. |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 28 Aug 2011 07:02 AM |
--for the first case (i know this is a latepost, but i did it already so i'm posting it local rocketcf, torsocf = ? local ray = Ray.new(rocketcf.p, rocketcf.lookVector*(torsocf.p-rocketcf.p).magnitude) local point = ray:ClosestPoint(torsocf.p) local newcf = CFrame.new(point) * (rocketcf - rocketcf.p) local x = torsocf:toObjectSpace(newcf).X if x > 0 then --right else --left (or it could be right at the same x as the torso) end
Try and indent your code by four spaces next time so us forum enhancer users get syntax highlighting.
|
|
|
| Report Abuse |
|
|
|
| 28 Aug 2011 07:03 AM |
pretty sure that the roblox forum doesn't let me do four spaces at once
and i don't like your forum enhancer thingy, it sounds dumb
*resists change*
.:Like a boss:. |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 28 Aug 2011 07:04 AM |
It really isn't dumb. Code formatting on a scripters forum is not dumb. At least try it
Besides, you can still type the four spaces in the edit box. They'll only be visible to us, but roblox does save them. |
|
|
| Report Abuse |
|
|
ss1122
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|
ss1122
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|
ss1122
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|
ss1122
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|
ss1122
|
  |
| Joined: 16 Dec 2008 |
| Total Posts: 1601 |
|
| |
|