HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Locking on to a target ?

07-18-2005, 03:00 PM#1
cowboybill
I was wondering if there was a way to trigger it so that when a unit selects a target , the camera automatically faces it and follows it (not the unit just the camera) until it dies or unselected. is this possible while the unit is using a custom 3d camera.

so....can the camera change from the units 3d cam to lock on to his target. then change back to the units 3d cam if his target is destroyed or resets back to normal cam....thx
07-18-2005, 03:03 PM#2
Guest
make a normal 3rd person trigger to lock on a variable unit (array if more than 1 person) then when the unit selects the unit u want just apply the variable to unit and set it to no unit when you want it to stop
07-19-2005, 04:57 AM#3
cowboybill
Quote:
Originally Posted by xerox237
make a normal 3rd person trigger to lock on a variable unit (array if more than 1 person) then when the unit selects the unit u want just apply the variable to unit and set it to no unit when you want it to stop


sorry but i still can't quite get it , im not so good with triggers. would u mind posting a sort of sample trigger of how this would look. thx
07-19-2005, 12:41 PM#4
Ant
Well, just search the forums for your generic 3rd person camera or any custom camera.

Detect when a unit selects a target (I'm guessing this either means a unit acquires a target, a unit chooses a target to attack, or the player selects a unit). Then lock the camera to that unit, change camera fields, etc, doesn't take a rocket scientist to figure out. Set a variable to the unit, so you can detect when it dies. Then when it dies, go back to the normal camera.

That's for the camera jumping to the location of the selected unit. However, if you want locking on, set the facing angle of the camera to the angle between the two units (it's somewhere in there, angle between two points). Then set it to normal when you detect the unit has died.

If you want the camera to target the targeted unit, then use set camera orientation
07-19-2005, 04:30 PM#5
cowboybill
Quote:
Originally Posted by Ant
Well, just search the forums for your generic 3rd person camera or any custom camera.

Detect when a unit selects a target (I'm guessing this either means a unit acquires a target, a unit chooses a target to attack, or the player selects a unit). Then lock the camera to that unit, change camera fields, etc, doesn't take a rocket scientist to figure out. Set a variable to the unit, so you can detect when it dies. Then when it dies, go back to the normal camera.

That's for the camera jumping to the location of the selected unit. However, if you want locking on, set the facing angle of the camera to the angle between the two units (it's somewhere in there, angle between two points). Then set it to normal when you detect the unit has died.

If you want the camera to target the targeted unit, then use set camera orientation


yeah what im trying to do is have the unit lock on to a target while in his camera. so basically u can see ur unit running and the unit being targeted at the same time.
07-19-2005, 05:50 PM#6
Guest
Use this, theres a bug in it for hieghts but u can figure it out. You can set players marine to no unit or set it to something and turn it on/off respectivly
Code:
Third Person View
    Events
        Time - Every 0.20 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
            Loop - Actions
                Camera - Lock camera target for (Picked player) to Players_Marine[(Player number of (Picked player))], offset by (0.00, 0.00) using Default rotation
                Camera - Set (Picked player)'s camera Rotation to (Facing of Players_Marine[(Player number of (Picked player))]) over 0.60 seconds
                Camera - Set (Picked player)'s camera Angle of attack to 340.00 over 0.01 seconds
                Camera - Set (Picked player)'s camera Distance to target to 350.00 over 0.01 seconds
                Set Camera_Height[(Player number of (Picked player))] = 100
                Camera - Set (Picked player)'s camera Height Offset to Camera_Height[(Player number of (Picked player))] over 0.01 seconds
07-20-2005, 09:35 AM#7
Ant
Righto. Xerox just gave a generic 3rd person camera. Generally it's smoother if your applying camera time is longer or equal to the period of the triggers, or else it looks jerky.

And of course, if you want to lock on, then when a unit is selected, use the trigger set camera orientation to the locked on unit. The difference between orientation and target is that if you change the target, your whole camera shifts to the location of the unit, without turning, just moving, so you may lose sight of the original unit, whereas if you change camera orientation, your camera turns towards the unit, while still being over the original position.

Well all these you should have figured out already if you tested and played around with it.
07-20-2005, 04:36 PM#8
cowboybill
Quote:
Originally Posted by Ant
Righto. Xerox just gave a generic 3rd person camera. Generally it's smoother if your applying camera time is longer or equal to the period of the triggers, or else it looks jerky.

And of course, if you want to lock on, then when a unit is selected, use the trigger set camera orientation to the locked on unit. The difference between orientation and target is that if you change the target, your whole camera shifts to the location of the unit, without turning, just moving, so you may lose sight of the original unit, whereas if you change camera orientation, your camera turns towards the unit, while still being over the original position.

Well all these you should have figured out already if you tested and played around with it.


thx guys for the help. it seems to be working, still testing and such. but thx.