So I have this issue where i have a car spawner, it looks like this: Car video, but with some of the bigger cars it looks like this: Car Video 2, how could i make it so the bigger cars CFrame ontop of the carpet?
Hi!
You can do this very easily!
Now, set each cars CFrame (when showcasing) to be as following:
-- We just take the Cars Size in the Y axis, and divides it by 2, then we have the middlePoint of the car, and by default the wheels will exactly be touching the ShopPlatForm's CFrame. :D
-- You can then add a little extra like "0.10" like I've done, to make it float a little over the platform if needed, if you don't want that, just remove the "0.10 +" part)
Car.CFrame = ShopPlatform.CFrame + Vector3.new(0, 0.10 + Car.CFrame.Size.Y/2,0)
This works amazingly with a part, but I’m using a group and I cant get the size, do you know any way I can do this?
If you’re using a model you could try using model:SetPrimaryPartCFrame()
. Here’s the documentation: Model:SetPrimaryPartCFrame
Will that get the size of the group?
It basically changes the CFrame of the model, like how you can move models around using your mouse in studio. Maybe for getting the size of the model you could use Model:GetBoundingBox or Model:GetExtentsSize. I recommend you read Roblox’s documentation on models. There’s some useful stuff in there. Model
Hi!
Please consider using Pivot
Model:PivotTo(ShopPlatform.CFrame + Vector3.new(0, 0.10 + Car.CFrame.Size.Y/2,0))
https://developer.roblox.com/en-us/api-reference/function/PVInstance/PivotTo
The old way of doing it was how snake_case mentioned it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.