|
| 24 Jul 2013 12:48 PM |
function Place(Spot,Foot) ap = Foot.Parent:GetChildren() local P = Foot.Position Foot.CFrame = CFrame.new((Spot.Position+Vector3.new(0,Spot.Size.y/2,0))+Vector3.new(0,Foot.Size.y/2,0)) P = P-Foot.Position for i=1,#ap do if ap[i].className == "Part" and ap[i] ~= Foot then ap[i].CFrame = ap[i].CFrame-P end end end
This function allows me to place towers in my element td game. It works, and I like it. Recently I decided I wanted to reduce the number of players from 8 to 6 to try and reduce lag, but in order to do that and still allow players to communicate freely I wanted to arrange the maps into a hexagon grouping, meaning 4 of the maps are going to be rotated. I assumed that the towers, when built, would rotate automatically due to the cframe but I was wrong. This caused skewed towers, towers that didn't line up with the map spots. Now, while it doesn't cause problems, it is an eyesore. I have always been upside left and inverted when it came to euler angles. The whole thing just confuses me.
Can someone help me to rotate the tower based on the direction of the FrontSurface of the spot? The spots the towers are built on and the feet of the towers are always TopSurface up, so if that helps simplify things then great. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2013 12:51 PM |
| or CFrame rotation, idc which. I just wanna rotate the tower to line up with the spot. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
mrmrluaa3
|
  |
| Joined: 25 Jun 2013 |
| Total Posts: 122 |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 25 Jul 2013 09:44 PM |
Most bumps I've ever seen. That's impressive.
Cakes always lie. That is the truth. I am a cake. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 26 Jul 2013 02:59 PM |
Yeah but I wouldn't have to bump so much if someone would help :( I usually try to do things on my own but when I get stumped really badly I come here. I don't always get the help I want. Sometimes I do, but most of the time the solution hits me before someone answers. This one is different. I simply do not know how to rotate the tower based on the direction the spot is facing. |
|
|
| Report Abuse |
|
|
| |
|
|
| 26 Jul 2013 06:52 PM |
bump
(You know, I can do this for the rest of my life :/ ) |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Jul 2013 01:35 AM |
Honestly, the script thing you have looks kinda confusing or at least without the whole script it is. If you want to get a certain part to look towards a point you just have to do something like this:
Workspace.Part.CFrame = CFrame.new(Workspace.Part.Position,Vector3.new(whereyouwanttolook))
I know it doesn't solve your problem but it should help you get started. You might also want to brush up on lookVector cuz that'll probably be the most essential thing to learn about for your situation. Oh yeah and how are you able to make that script but not understand angles >_> it looks so complicated...
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2013 03:14 AM |
| *CFrame.new(0,math.pi/3,0) |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Jul 2013 10:27 AM |
@onetime, telling it a specific direction to point would be useless. it would work maybe for one map, but not the other 5.
@monkey, rotating the parts on Y angles would simply tilt the towers on their sides |
|
|
| Report Abuse |
|
|
tdog158
|
  |
| Joined: 08 Jul 2008 |
| Total Posts: 5413 |
|
|
| 27 Jul 2013 10:40 AM |
| Manually rotate with a rotation tool and take note of the part's rotation. Or rework your system so it's easier for you to use. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2013 11:47 AM |
| @xaio again, what you said confused me in a way and I can't visualize the problem but what I imagined was that you wanted a hexagon with all of the towers looking inward to the center of the hexagon. If you apply the thing that I mentioned above, then you could have all of the towers looking at the same point in the center. |
|
|
| Report Abuse |
|
|