|
| 11 Sep 2016 11:35 AM |
Note: I can not use p.CFrame = CFrame.new(p.CFrame.p, p2.CFrame.p); as I just want it to be a rotate in a general direction and gradual rather than instant.
Here's what I've: local rotation = function(p1, p2) local dir = (p2.Position-p1.Position).unit; p1.CFrame = p1.CFrame * CFrame.fromAxisAngle(dir, math.rad(30)) end;
It works if the object is directly in front of the model, however if it's not, it will rotate in essentially the opposite direction. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 11:37 AM |
um its called lerp
obj.CFrame = obj.CFrame:lerp(CFrame.new(obj.CFrame.p,part.CFrame.p),0.1)
or you can use a Body Gyro
and to make it rotate in the opposite direction, multiply by rad(180) Y angles |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 11:40 AM |
| I wasn't aware lerp even existed as a method, I'll try it\. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 11:48 AM |
| Nope, faces the same problem as my previous methods. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 11:49 AM |
| obj.CFrame = obj.CFrame:lerp(CFrame.new(obj.CFrame.p,part.CFrame.p)*CFrame.Angles(0,math.rad(180),0),0.02) |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 11:49 AM |
| declare obj and part as variables instead of replacing them |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 11:54 AM |
model:SetPrimaryPartCFrame(thruster.CFrame:lerp(CFrame.new(thruster.CFrame.p, goal.p) * CFrame.Angles(0, math.rad(180), 0), 0.3));
Result: Still facing the wrong dir. |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Sep 2016 12:00 PM |
| The thing is the first iteration I used when I said it didn't work, did infact not use CFrame.Angles. I'll probably have to manualy calculate the distance. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:01 PM |
dude it works correctly, you just do it horribly it will lerp the cframe of the part to the cframe of it pointing to another object |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:01 PM |
| you want to use GetPrimaryPartCFrame most likely anyways |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:08 PM |
"dude it works correctly, you just do it horribly it will lerp the cframe of the part to the cframe of it pointing to another object" So since your solution didn't work you attack me.. Classy. How am I doing it horribly when it is literally the code you gave, modified for my situation? If I was doing it horribly then so were you boyo.
"you want to use GetPrimaryPartCFrame most likely anyways" Thruster is the primary part so it makes no empirical difference. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:11 PM |
it works, the problem is that you dont know how to use it you idiot
watch this gif to see how you are helpless
goo.gl/OJ3jEm |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:14 PM |
while wait() do script.Parent.CFrame = script.Parent.CFrame:lerp(CFrame.new(script.Parent.CFrame.p,workspace.e.CFrame.p),0.1) end
is the code i used so its not my problem |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:18 PM |
| I understand that it works for small parts which is why I said "within the context that I am using it". And if I am using it wrong then how about showing what I did wrong then? I am willing to learn if you think I did it wrong then show. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:19 PM |
model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame():lerp(CFrame.new(model:GetPrimaryPartCFrame().p, goal.p), 0.2))
and set goal as the part every time |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:32 PM |
| ############################################################################################################# |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:33 PM |
| I tried it and the method isn't working for this. I will try to manually calculate the angle I guess. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:34 PM |
that is because goal needs to be the cframe of the other object at all times if you are not setting it to that cframe, things will go wrong |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:37 PM |
| @ daily just ignore him and let this thread die... he obviously isn't wanting a quality answer... this fool thinks you should spoon feed him the EXACT answer.. he isn't willing to go the extra mile. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:38 PM |
| lol the gif even works correctly idk what this dude is doing wrong |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:41 PM |
| I am not asking for a spoonfed answer it's just that when I use the method for the model, it works the same way my .unit rotation solution worked. I can get both solutions to work for small parts but this isn't working at all for the model I am using. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:42 PM |
then make sure that goal is always what you want to point to goal = thing.CFrame
other than that idk what you did wrong |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2016 12:44 PM |
| The problem is probably that it is rotating the model correctly but what you think the "front" of the PrimaryPart is probably actually a different size. |
|
|
| Report Abuse |
|
|
| |
|