Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make an opening hood on a car?

Asked by 4 years ago
Edited 4 years ago

Code I have so far:

script.Parent.ClickDetector.MouseClick:Connect(function()
    script.Parent.CFrame = CFrame.new(script.Parent.Position, script.Parent.Parent.FrontHood_I.Position) 
end)

Though a problem with the script is that FrontHood_I's position makes script.Parent (named FrontHood) turns vertical instead of staying horizontal (FrontHood size XYZ values: 5.9, 0.5, 8.5). How do I keep FrontHood or script.Parent, horizontal instead of turning vertical? Also, FrontHood_Iis already vertical. It is an invisible part so FrontHood or script.Parent can move.

I simply want the hood to move from one position to another position and also have a rotation, like a car in real life would. For example, when a SUV's hood is opened, it starts flat and then opens to like a 60 degree angle or something. That's what I'm looking for.

0
Do the CFrame thing and change the orientation of the Hood. Fate2Seal 5 — 4y

1 answer

Log in to vote
0
Answered by
Prestory 1395 Moderation Voter
4 years ago
Edited 4 years ago

Try this

script.Parent.ClickDetector.MouseClick:Connect(function()
    script.Parent.CFrame = script.Parent.Parent["FrontHood_I"].CFrame
end)

(Make sure to position "FrontHood_I" to the exact position you want it to be when the hood is open)

0
lol TheluaBanana 946 — 4y
0
Whats funny :P Prestory 1395 — 4y
0
probably those people who randomly comment random things like i do occasionally lol sean_thecoolman 189 — 4y
0
prestory your answer does work but it still turns out vertical though ill mess with the script a bit more ur good kthxbye sean_thecoolman 189 — 4y
0
NP, good luck Prestory 1395 — 4y
Ad

Answer this question