Scripts / Request : How to control the camera position and rotation ?

Author
Message
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 7th May 2016 17:42
Hi all,

Is it possible to control the camera position and rotation ?

Let me explain :

I made some trigger objects that allow to perform actions : (move stone block, activate the movement of a platform, disable spike traps, etc...)

1) - The player is in front of a trigger object.
2) - The player activates this trigger object.
3) - The camera is positioned in front of the object associated with the trigger.
4) - The action of the object begins : for example a stone block moves, or the platform begins to move, etc...
5) - The camera is positioned at its original location (behind the player).

For the moment, I made the trigger and the associate object (a mechanical lever and a moving stone block)
The initial position of the "moving stone block" is idden in the wall.
When I activate this lever, the stone block moves outside the wall (moving from left to right approximately 1 meter)

That works well, but when the stone block moves, it is outside the field of the camera... so, we don't see the move...

Thank you if anyone knows how to do this !
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th May 2016 18:26
from what i can gather this is for third person right? so something like this?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 7th May 2016 23:52
YESSS !

Smallg, you're the best (as usual !)
Please, tell me how you did that ???
PM
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 8th May 2016 00:21
For information,

Here the trigger model I use.
Once this one is activated, the global value "move_stone01" is = 1, meaning the target object "moving stone01" moves from left to right at a defined distance.

Soon, I'll implement the possibility to reverse the trigger function in order the moving stone go back at it's original location...

I'll share these scripts once they are completed...

Vidéo link :
https://www.youtube.com/watch?v=WGbBCc4IHPU

Thanks !
PM
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 8th May 2016 13:12
@Smallg,

As I didn't stay to wait for the solution arrives "ready-made", I thought how to you do that in your video ?

Perhaps there is a possibility to do something with the "TransportToIfUsed(e)" or "TransportToFreezePosition(e)" functions to move the camera (or the player) to another object ? ...and as soon as the animation of the object "target" is complete, return to its initial position...

...but for now, I didn't found how to do !

Is that a good "approach" of the solution ?

Thanks !


PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th May 2016 17:16
this is how i did the video, should be enough to let you do what you need to do.

lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 8th May 2016 21:44
Thanks Smallg !

Good training to learn LUA script !
PM
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 9th May 2016 23:17
@Smallg,

Let me explain what I did from your script in order to adapt it for me :
There are three inseparable objects working together; Trigger, Camera_Event and Target.
Each Trigger control a Target. The Camera_Event is there to follow the action of the Target object.

First step : The player activates the Trigger.
Second step : The "3D view" is positioned at the Camera_Event location and towards the Target object.
Third step : Once the Target object has completed its movement, the "3D view" is restored to its original location (behind the player)

As this is a first draft script, some things don't work quite correctly...

At the second step it's still possible to control the movements of the camera with the mouse ...then we should not be able to do !
Also, the position of the player isn't correct relative to the Camera_Event position...and I don't know how to fix that...

See the picture attached for more details about objects used...
Tell me if you need I send you the script files and the test level ?

Video link :
https://www.youtube.com/watch?v=7kT3vkqkJ9g

Thanks again !

Attachments

Login to view attachments
PM
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 12th May 2016 18:49
Hi all,

The Event_camera system works fine now !

Video link :
https://www.youtube.com/watch?v=edJcgdvN9W0

if needed, scripts are available for all... just ask me,

Thanks !
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th May 2016 20:03
grats, looks very good indeed
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 12th May 2016 22:33
Thank you !


not very useful for a FPS, but it can serve to a game like "Zelda" or "Tomb Raider" ...

without any pretension !
PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 12th May 2016 23:39
Nice Mariokiki !

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Mariokiki
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 13th May 2016 00:39
Thanks 3Com !
PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 14th May 2016 14:05
Excellent. Nice job.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Login to post a reply

Server time is: 2024-04-27 08:12:55
Your offset time is: 2024-04-27 08:12:55