Having the mouse move an object instead of the player's view

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Night Falls
Posts: 47
Joined: Mon Mar 09, 2020 4:32 pm
Location: A hole in the bottom of the sea

Having the mouse move an object instead of the player's view

Post by Night Falls »

I'm doing a top-down sort of game with a third person camera that follows the player and is always pointing the same direction.
I've got the camera working, and the movement, though I'm still trying to figure out the mouse.

The idea I'm going for is having a sort of mouse pointer actor being moved around the level via actual mouse movements, and it wouldn't affect the player's angle or pitch (I'm planning to just have the player face the pointer when I want them to instead of having mouse movement directly affect the player.)
I'm guessing I'll have to write an event with inputprocess which detects the mouse x an y and moves the pointer accordingly, while also keeping it from changing the player's angle and pitch, though I haven't gotten much of anything done beyond that.

Zscript is not my strongpoint (though hopefully after enough screwing with it and asking questions I'll get it figured out), so any help is welcome!
User avatar
Cherno
Posts: 1311
Joined: Tue Dec 06, 2016 11:25 am

Re: Having the mouse move an object instead of the player's

Post by Cherno »

A word of warning: This is a fairly complex task.

You can use Libeye to translate world coordinates from cursor (screen) coordinates. I believe there are examples included with the libbrary that provide a starting point for such operations.
Post Reply

Return to “Scripting”