dansk
|
  |
| Joined: 24 Dec 2008 |
| Total Posts: 548 |
|
|
| 11 May 2015 11:14 PM |
| Alright so Im trying out lerp() because it looks like a pretty interesting method. However, I'm confused to if you want to lerp a brick but still have the brick be inside another brick. Like I want to lerp one brick into another brick. I know doing Brick.Position = Vector3() will make the brick go to the top of the other brick but if I do Brick.CFrame = Cframe() then the brick will go inside the other brick. How do I make it so that I can lerp Cframes basically. Im sorry if I suck at explaining this. |
|
|
| Report Abuse |
|
|
dansk
|
  |
| Joined: 24 Dec 2008 |
| Total Posts: 548 |
|
| |
|
|
| 11 May 2015 11:47 PM |
Lerp means Linear Interpolation.
And yes, I'd say you did failed at explaining. Can you explain again? I don't get it. |
|
|
| Report Abuse |
|
|
dansk
|
  |
| Joined: 24 Dec 2008 |
| Total Posts: 548 |
|
|
| 12 May 2015 12:26 AM |
So you know how you can do
Brick.Position = Brick2:lerp(brick3, 0)?
How do I do that with cframe |
|
|
| Report Abuse |
|
|
dansk
|
  |
| Joined: 24 Dec 2008 |
| Total Posts: 548 |
|
| |
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 15 May 2015 12:45 AM |
i think you are looking for a cframe interpolator?
stravant has one |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 15 May 2015 12:48 AM |
| http://www.roblox.com/CFrameInterpolator-Module-item?id=161739700 |
|
|
| Report Abuse |
|
|
dansk
|
  |
| Joined: 24 Dec 2008 |
| Total Posts: 548 |
|
|
| 15 May 2015 12:59 AM |
| How does it work? I see in the function only 2 values: pos1 and pos2 but lerp() takes 2 positions and a ratio |
|
|
| Report Abuse |
|
|
dansk
|
  |
| Joined: 24 Dec 2008 |
| Total Posts: 548 |
|
|
| 15 May 2015 01:00 AM |
| Pretty much I want something like I can lerp2 bricks than use the position I get from the lerp to frame another brick into there. Pretty much if the brick doesn't fit into the space i.e. there is another brick there, then it will simply go inside the other brick |
|
|
| Report Abuse |
|
|
|
| 15 May 2015 01:32 AM |
function lerpCFrame(c0,c1,a) local o = {c0:components()} local n = {c1:components()} local lerp = {} for i = 1,12 do lerp[i] = (o[i] + (n[i] - o[i]) * a) end return CFrame.new(unpack(lerp)) end |
|
|
| Report Abuse |
|
|
|
| 15 May 2015 01:50 AM |
Erm...
Yeah...
About lerp to CFrame...
I managed to convert my Tween Part lerp into CFrame quite simply.
I'll check once I go into my Desktop (I'm on chromebook). |
|
|
| Report Abuse |
|
|
Voiliax
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15554 |
|
|
| 15 May 2015 02:23 AM |
OP simply wants a translation lerp with a CFrame value instead of a Vector value.
This should be sufficient:
brick.CFrame= CFrame.new( p1:Lerp(p2, alpha) ) |
|
|
| Report Abuse |
|
|
|
| 15 May 2015 05:13 AM |
and lerp rotation too, its a vector3.
therefore you dont have to go indepth |
|
|
| Report Abuse |
|
|
|
| 15 May 2015 11:22 AM |
@Cres
Its still saver to work with the rotation matrix since it is precisely capped at -1 to 1 |
|
|
| Report Abuse |
|
|
| |
|