|
| 19 Dec 2015 04:01 PM |
Hello, I successfully made it so my fishes fins and tail moves. The only thing I have left to do is to make it so the entire fish moves. The issue is my fish is a model, not a solo brick. I however did make a script that moves a mesh of a fish to various locations, but it teleports the fish, the fish doesn't move smoothly.
Fish = script.Parent
while wait(2) do -- Infinite loop! Fish.CFrame = CFrame.new(math.random (1,100),math.random (1,5),math.random (1,100))
end
How can I make my model of a fish move to various locations like the script above, but make it move smoothly and not teleport? The script below I think is very wrong.
local children = workspace.Fish:GetChildren()
while wait(3) do -- Infinite loop! for i = 1, #children do children.CFrame = CFrame.new(math.random (1,100),math.random (1,5),math.random (1,100))
end end |
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 19 Dec 2015 04:13 PM |
| You're just repeatedly repositioning the fish's children to random positions. In code theory, did you even think this made sense? You need to give the fish a start position and then loop through by adding an incremental value to the fish's position and make it go further. You may want to raycast some checks too for turning to make sure it doesn't just go through walls. You can also add some randomization by multiplying the incremental CFrame value with a random angle to also add to it. Make sure to keep the value relatively small so it doesn't spin randomly for no reason. |
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 19 Dec 2015 04:14 PM |
| By the way: You can either set the PrimaryPart of your fish model and use that, or you can weld the fish to one object inside of the model. That way the fish will move together and not all over the place. |
|
|
| Report Abuse |
|
|
| |
|
triode
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 5844 |
|
|
| 19 Dec 2015 04:43 PM |
As much as I'd like to help, I would be giving away my fish animation. I am working on a game that will be tycoon/Real life based.
Well two games, yee |
|
|
| Report Abuse |
|
|