View unanswered posts | View active topics It is currently Tue Apr 16, 2024 8:27 pm



Reply to topic  [ 6 posts ] 
 Any way to track the current position of the cursor? 
Author Message
User avatar

Joined: Sun Dec 25, 2011 7:23 am
Posts: 269
Reply with quote
Post Any way to track the current position of the cursor?
Are there any code pieces or ways to return the vector of the current position of my cursor in game?


Sat Feb 25, 2012 4:10 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Any way to track the current position of the cursor?
Not any that I know of. What are you trying to do, exactly?


Sat Feb 25, 2012 6:09 am
Profile
User avatar

Joined: Sun Dec 25, 2011 7:23 am
Posts: 269
Reply with quote
Post Re: Any way to track the current position of the cursor?
It's...

Image

Something magical.
(Link if the gif doesn't work)

Well I'm trying to combine Abdul Alhazred's Hammer R2 Mod and Azukki's Wrecking Ball Mod into a single Hammerfight (aka Hammerfall) mod that truly resembles the original game.

Right now I'm trying to figure out how to make the craft mouse-steerable while still giving the player a good amount of control.
Azukki's Wrecking Ball mod makes the craft/ball travel based on the angle that the craft is facing (somewhat like which direction the mouse is facing towards), but the main problem is that you can't control the velocity of the vehicle very easily.

Other things I'm thinking of adding are
- Weapon momentum (Swinging a tiny sword will feel very different from swinging a massive hammer)
- Weapon Sharpness (Simulated by generating those Wrecking Ball buzz saw particles around the "sharp" edges of weapons)
- Shields
- I also remember someone making a slow-mo mod. Might be a bit beyond my current modding level to implement something similar, but it'll be awesome if I eventually do get it in.


Sun Feb 26, 2012 11:04 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Any way to track the current position of the cursor?
The code snippet:
Code:
actor:GetController().MouseMovement

is a vector defining how much the mouse has moved. So while you can't exactly tell WHERE the mouse is, you can still tell what direction it's moving at what magnitude. You can then use that vector and add it to the position of something that you're controlling to mimic the movement of the mouse.


Sun Feb 26, 2012 9:29 pm
Profile
User avatar

Joined: Sun Dec 25, 2011 7:23 am
Posts: 269
Reply with quote
Post Re: Any way to track the current position of the cursor?
Sweeet, Thanks a lot CaveCricket48!


Mon Feb 27, 2012 7:44 am
Profile

Joined: Sat Dec 04, 2010 4:48 am
Posts: 13
Reply with quote
Post Re: Any way to track the current position of the cursor?
i remember there is a lua function in SceneManager named GetOffset or something like that, which will return the offset of the viewport (left-top oriented), you may need to add a vector of half the width and height of the viewport to get the center position of the viewport which should be also your cursor position.

Another alternate may be the actor.ViewPoint... but i'm not quite sure about that.

Just try them and see if either of them is satisfactory.


Mon Mar 05, 2012 6:24 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.043s | 15 Queries | GZIP : Off ]