Another rotating thread - rotate a stick by its one end
Hunnenkoenig
Member Posts: 1,173
Ok the title is a bit confusing, but I couldn't explain it in another way.
What I want to do:
An UFO is hovering above the city and it shoots laser beams to the ground.
I want to place the beam to the screen, fixing its one end to the "cannon" of the UFO and make its alpha to 0.
Now let say every 3 seconds I set the alpha to 1 so the beam is visible and I want to rotate it randomly, so it looks like it shoots in different directions, but I want one end always fixed to the UFO, so only the bottom end of the beam hits the ground in different positions.
I looked around but I found only 11 month old threads. I assume, I should work with "Rotate to Position", but I don't get it how it works.
What I want to do:
An UFO is hovering above the city and it shoots laser beams to the ground.
I want to place the beam to the screen, fixing its one end to the "cannon" of the UFO and make its alpha to 0.
Now let say every 3 seconds I set the alpha to 1 so the beam is visible and I want to rotate it randomly, so it looks like it shoots in different directions, but I want one end always fixed to the UFO, so only the bottom end of the beam hits the ground in different positions.
I looked around but I found only 11 month old threads. I assume, I should work with "Rotate to Position", but I don't get it how it works.
Comments
This is assuming the laser beam being shot down is like a baseball bat arc down into the city (sort of like the lasers tearing down the streets in the Tom Cruise starred remake of "War of the Worlds").
If you just need a short laser burst that follows another actor, I think there is a "follow actor" or "follow me" demo in JCFord's profile.
(awesome demo by the way FMG)
My head is already exploding, so I will look at it tomorrow.
Now I didn't understand a word from those projects :-)
I think, I will figure it out somehow tomorrow :-)
Can somebody help me how to start this?
I don't understand those sin and cos and angle here and angle there in those projects.
I don't want to move my laser beams, they should only change angle fixed on one end.
If somebody could only make me a small demo, where a vertical stick's bottom end moves from left to right in a 45° angle, where the top end is fixed, I would be very happy.
I am an idiot with math and my english is also crap and about programming I have no clue...
The only problem with this solution is if you don't want things above the UFO to collide with the laser, you're out of luck. But if it's just hovering at the top of the screen and all the player interactions are below, collisions work just fine.
Yeehaaaa!
I first used FMG's demo and tested it.
Then I created two invisible images. One is positioned on the ufo and doesn't move, the other jumps every second to a random location in a certain area (change X to random(0,320) and change Y to random(0,100) ) and the beam appears whenever the jumping actor sets an attribute to true. The jumping actor sets it to false after 1 second.
Now my UFO shoots laser beams everywhere on the ground.
It looks sooooo cool!
Thanks guys!