So I’m working on a resource system that drops loot after you destroy it. As of right now the resource drops in a circle as shown below. How can i make the position of the dropped resource random but within a close distance to the destroyed part?
handle.CFrame = anchor.CFrame * CFrame.new(0, math.sin(tick() * 2), 0) * CFrame.Angles(math.pi / -2, 0, 0)
anchor.CFrame = anchor.CFrame * CFrame.Angles(0, 3 * dt, 0)
Change the position by a random number e.g
Pos = vector3.new(tree.position.X + math.random(min,max),tree.position.Y,tree.position.Z + math.random(min,max))
And that will put them in a random position within the given distance on the same y axis as the tree, ylu can use something similar to offset from cframe if you wanted it to match the rotation of the tree on a slope or something of the sorts.
2 Likes
Do i have to add vector 3 or can i just keep the cframe and math.random?
If you keep it as cframe then add that to the positional values