• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

First Person Camera?

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
I've seen some examples made of some First Person type Camera systems. But they all seem outdated and don't work. Does anyone know of a system that exists that I could implement into a map?

Basically just looking for if possible, moving around the screen using the mouse. And moving with the WASD keys. Thanks.
 
Level 19
Joined
Jan 1, 2018
Messages
741
I'm not aware of any first person camera systems, but I do have an idea of how you could make one with the new natives in patch 1.31.

You would constantly reset the cursor to the center of the screen using BlzSetMousePos, BlzGetLocalClientWidth, and BlzGetLocalClientHeight.
Then, to detect when your cursor is moved, you can use BlzTriggerRegisterFrameEvent, with frameeventtype FRAMEEVENT_MOUSE_ENTER, and then place a number of framehandles around the center of the screen.

I made a quick test using 440 frames (21x21-1) and it seems to be working, although it does impact the framerate quite a bit, so you should not make too many.
I also didn't use BlzFrameCageMouse, so I needed the space and amount of framehandles to be quite large for the cursor not to escape the center of the screen.

If you're not used to working with JASS, I'm sure this answer is quite useless to you, so maybe someone else could be kind enough to turn this idea into a library.

Also, in regards to your question about moving with WASD, you could probably find existing systems that work with arrowkeys.
All you'd have to do is replace the arrowkey events with BlzTriggerRegisterPlayerKeyEvent.
 
Status
Not open for further replies.
Top