Scripts / [SOLVED] Mouse click on objects

Author
Message
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 2nd Jun 2020 18:58
I check this every now and then. Wanted to ask if GG has a function to convert 2d coords to 3d coords so we can click on objects yet?
Taking into account angels, fov , and screen resolution?

I try this every now and then and do get it working. But coming up with a formula to account for everything is something that I can't get my mind around.

I would be happy to pay a couple hundred dollers for a function that could do this if GG will not add it.

Just having that function in the tool box will be a life saver!

The author of this post has marked a post as an answer.

Go to answer
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 2nd Jun 2020 20:17
Quote: "Wanted to ask if GG has a function to convert 2d coords to 3d coords so we can click on objects yet? "

So Ames just won $ 200, not bad.

Nevin you are best posting your question in the script section, there you can get more support. Hopefully, some mod does the job.
Also check the Ames thread he have nice solutions there, even for you.
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
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 3rd Jun 2020 03:07
GG engine has all that information all computed and easily accessible--
If only TGC team would release it--. All it would take is for them to decide
that they are okay with releasing this data to users!
As anyone might have noticed I've been trying to mention this idea over a
few posts so that it can be accessible to the whole community. There
should be not complex coding required. PromptLocal accesses that data
and uses it to place the Text at the screen coordinates of the object....
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 3rd Jun 2020 03:14
I've always had issues with getting it exact, considering its all based on percent on the screen and than you have to consider what aspect ratio/resolution others may be using. So you'd have to test a number of them.

Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 3rd Jun 2020 17:22
"So you'd have to test a number of them."

Testing is all done. Perhaps a deep Google search in old Unity or Unreal
forums might yield some info, but seriously guys have you ever used the
Game Guru map editor? It's flawless at mouse hovering over any item at
any screen resolution at any distance and angle-- and clicking the object.

Up, down, sideways, backwards or in the far corner behind a building...
That's about all we need to realize- it's no different there than in a running
game. All the data is running constantly in GG engine, but not revealed.

A possible way for a third party to come up with a module to compute the
coordinates is for the player to click on objects while observing the output.
Either that or something to do with ray casting... ?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Jun 2020 20:37
It's not just 'all there' at all. It is done in the editor using ray casting but the problem is that in the editor the view is a very simple camera view, fixed FOV no post processing or anything.

I have previously posted a solution last time this came up, a simple Lua script to do exactly what you are asking for.
Been there, done that, got all the T-Shirts!
PM
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 3rd Jun 2020 21:32
@AmenMoses

I have read your scripts.
I work on top down games. So the script you made with first person does not work.
But i loved the script that you made. I did edit it (and took ideas from another script) and got it working from a top down perspective.

But manually setting all checks, not having a formula, bec im not a master coder, wont work for a standalone build.
A script like this needs to take into account everything, screen height, and width, fov settings, all of it
I think I did a good job working with my crappy coding skills.

I have been on this topic for years. I offered money last year for someone to take on the project, Asked people, read other post on the topic, worked hours on a script.

GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 3rd Jun 2020 21:33
Excellent work AmenMoses. That's a great tool.
For me, I'm just curious as to what kind of creative features could be
implemented by the data sent to PromptLocal. It seems like enemy
huds and stuff could be furthered by that use. Of course a person
could literally place objects above the said characters-- which might
be the standard practice? I wouldn't complain at all if PromptLocal
just have the same resources added as say TextCenterOnXColor.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Jun 2020 21:42 Edited at: 3rd Jun 2020 21:44
This one is top down(ish)

It's the one from this video:
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 3rd Jun 2020 21:50
That looks really good.
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 4th Jun 2020 20:23 Edited at: 4th Jun 2020 20:41
So it seems that a real function is off the table. i will do the same thing I did last year, ill offer money to a coder to work with me

all that needs to be done is detect 3d cords under mouse. the hard part is the calculations
i dont have the math skills to do it. then i can do the rest

I know gameguru can be hard to work with. thats why im offering to pay

pm me if interested

ps... ill be back next year on the same topic
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 4th Jun 2020 20:51
Quote: "I know gameguru can be hard to work with. thats why im offering to pay"

Generally because that's something GG wasn't designed to do.
But Amen ignores that fact and does it anyway
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 4th Jun 2020 21:05
i will raise the money to 400$, if your trusted on gameguru ill pay 100$ before and 300 after we get a working script. ill use paypal.

@synchromesh
can i make a double post in the scripts area?

@synchromesh
i did get a script working for myself using different ideas people have used. but my calculations are off.

so i could hard code everything and it works 100%. but then different screen resolutions have to be considered if you're doing standalone.
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 4th Jun 2020 21:34
Quote: "can i make a double post in the scripts area?"

If you mean another one regarding this then no problem.
I could move this one but I think you need a fresh one. Contact Amen he could be your man.
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Jun 2020 21:51
So what's wrong with the script I posted?

Can't you use that as a baseline to do what you require?
Been there, done that, got all the T-Shirts!
PM
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 4th Jun 2020 22:48 Edited at: 4th Jun 2020 22:52
A couple of things i would have to change on the script. but i dont think the end result will be what im looking for.

lee hires an artist bec he wants his stuff to look good.

This is kinda the same thing.
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 4th Jun 2020 23:39 Edited at: 4th Jun 2020 23:40
Quote: "lee hires an artist bec he wants his stuff to look good.This is kinda the same thing. "

Not sure how to take that but Amen is one of the very best scripters around.
Lee couldnt really afford him if Amen charged full price
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Jun 2020 00:52
"one of"
Been there, done that, got all the T-Shirts!
PM
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 5th Jun 2020 00:56 Edited at: 5th Jun 2020 01:01
ya, the script good.

but i need to get cords under the mouse at a different angle.

so that math will change.

i have a pm i sent to smallg a wile back asking about this, i think last year haha.

but anyway ill start knew topic in scripts, ill make it more tords the point.

offer is 400 for a function
3dcords under mouse
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 5th Jun 2020 01:03 Edited at: 5th Jun 2020 01:26
if i knew how to do it, that be easy money

edit:
does lee still have that thing on github where you donate money for people who would like to be compensated for work??
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 5th Jun 2020 13:00 Edited at: 5th Jun 2020 13:05
You just have to play a bit with the funky maths, mate.
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
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Jun 2020 17:27
What angle are you trying to use it at that my funky math doesn't work for?
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 5th Jun 2020 18:13
I think I've spoken about this pretty much, and I still hold to what
I've already said. It sits in GG. You can't build a game engine without
the engine computing the screen coordinates of the objects.

Unity provides that info built in automatically. It's just 3 or 4 lines of code--
if you know how to work with the proper functions.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Jun 2020 18:58
The engine doesn't know the screen coordinates of the objects, the GPU is responsible for that and the position depends on lots of things not under the control of the engine, shader code for example and other post processing that is going on.

In the editor none of that applies so a simple ray cast in a straight line will suffice, in game however it isn't so simple as it depends on FOV and camera depth.

In fact the main engine doesn't even know if an object will get displayed on screen or not, the GPU may consider an object to be occluded or too small and cull it or a shader could render it invisible.

And what about sprites? An object may be completely obscured by a solid sprite but it is still 'on screen' as far as both the rendered and GG is concerned (even my script doesn't take account of sprites).

Long gone are the days when the engine directly controls what is on screen, nowadays it is just a bunch of data thrown at the GPU to sort out.
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Jun 2020 19:00
And yes my script above only works properly at a narrow range of look down angle, if you want a specific angle let me know what it is and I'll see if I can tweak the math to handle it.
Been there, done that, got all the T-Shirts!
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 5th Jun 2020 19:45 Edited at: 5th Jun 2020 19:47
Quote: "edit: does lee still have that thing on github where you donate money for people who would like to be compensated for work??"


There are very few members in the community that can help you with what your asking for. AmenMoses has made a lot of progress in this area.
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 6th Jun 2020 13:55 Edited at: 6th Jun 2020 14:56
@AmenMoses Im not 100% without checking. But when you set down a player marker and place a character on it, in priorities i set the y offset to 1000

This script shows some neat stuff I did not even think about. We could name a object and always display the objects name to the player with prompt local from a top down prospective and that is my favorite thing about the script. I will most likely use that bit.

For my project, I also do not use the 'real' player, like this script does. I can have more control over what the player is doing that way.
I have a character walk to the point of the player maker using Moveto and controlling animations using timers, instead of ai control manual

The bad thing is my script for the player and this script wont work out of the box. I would have to combine them.

So I offered to pay someone because there could be more... whats the word,? Transparency. I want to bounce ideas, have a contact to go to and pay for the time and work. offer up a job, negotiate a price and boom. I do a lot of code, even though im not vary good at it. Sometimes it takes all day to finish something that should have taken 1 hour. So I dont want to came to the forums asking for free scripts. A little help with something every now then, but not big scripts that take a mathematical genius to do.

So if someone becomes a contact, its not a one time deal. I would offer more 200$ or whatever scripts jobs. Sometimes like small edits to scripts. Even pay for information on the hidden functions of gameguru, or just functions I don't understand.

When I started I would buy scripts off the store just to see how they work. Check out free scripts on the forums to learn. Check out all the games coming out to see what other people are up to, @Teabone love the game your working on btw
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Jun 2020 15:12
This post has been marked by the post author as the answer.


Something like that then?
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Nevin
9
Years of Service
User Offline
Joined: 19th May 2015
Location: U.S.A
Posted: 6th Jun 2020 16:56
Yes

Login to post a reply

Server time is: 2024-12-22 03:20:00
Your offset time is: 2024-12-22 03:20:00