Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Pyro_guy
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: England
Posted: 29th Nov 2004 05:41
I've been trying to build a 3D cursor method for some time now, with varying amounts of success.

Basically, what I need is a cursor system that, when the user clicks, returns the current matrix coord's that the pointer is over so my player object can then travel to that location

To complicate things more, I have a camera which orbits the player object (However, I am willing to sacrifice this if it means a better cursor method, but ideally I would want to keep it)

Could somebody guide me through the maths or method I would need to do this? Thanks

Screw the rules...what can i blow up?
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 29th Nov 2004 06:35
what you say is very easy, all you need is a 3d object to show your position on the matrix and the position of the object is the position on the matrix, eg



if you look near the bottom of the code you can see a line remmed out, rem out the existing position object command and remove the rem from this to see the selection circle move in one square jumps as an alternative, the rest should be obvious, cheers.

Mentor.

PC1: P4 3ghz, 1gig mem, 3x160gig hd`s, Radeon 9800pro w cooler (3rd gfx card), 6 way speakers.
PC2: AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
Mini ATX cases suck.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 29th Nov 2004 07:33
Just to add to that, if you're wanting mouse control over the cursor, you will probably need to use 'pick object' to translate the 2d cursor position into the 3d position coordinates of the selected object.


Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 29th Nov 2004 07:52
You may even want to look into the pick screen command. If your floor is only one object.

Pyro_guy
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: England
Posted: 30th Nov 2004 01:08
Ah yes, reading over my post again I realise I didnt say that I wanted mouse control.

Thanks guys, I'll look into the pick_object command. But can this select a position on a matrix?

Screw the rules...what can i blow up?
Pyro_guy
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: England
Posted: 30th Nov 2004 04:50
Looking at the PICK SCREEN and PICK OBJECT commands in this topichttp://forum.thegamecreators.com/?m=forum_view&t=15701&b=7 I dont think that they would produce the effect I need.

The 3d cursor I would like to produce would act like the 'movement' cursor in an RPG game (such as dungeon seige) or RTS game (command and conquer). The PICK SCREEN command only moves the cursor object in a sphere around the camera, not accross the surface of the matrix, and the PICK OBJECT command is more applicable to object selection.

However, I think I may have found an easy method of doing this. I would appreciate any feedback people could give

The method is as follows:
When the user clicks, an object is 'fired' from the mouse position on screen, in a strieght line towards the matrix. Where the object collides with the matrix will be where the user thinks they have clicked on the matrix in 3D space.
Of course there are some complications I can see with this method, such as an object 'fired' from the very corner of the screen would not follow a path which would end up colliding with the matrix at the point that the user wanted (if you understand what I mean ) So I'd probably have to calculate a method of rotating the object to 'fire' at the matrix, depending on its X and Y screen coord, so it appears to strike the matrix directly where the user specifies.

I know I haven't been crystal clear in my description, but this is the best way I can think to describe it. I would like to know your opinions and thoughts about this method, and any help with the maths would be appreciated!

Cheers!

Screw the rules...what can i blow up?
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 30th Nov 2004 10:40
Yes pick screen works in spherical fashion but with some 3d maths, that I don't know, you can make it linear by changing the distance as the mouse moves. I have no idea how though I have seen an example somewhere. You may want to search for landscape editors or matrix editor code. Your way sounds good as well. Good luck

Pyro_guy
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: England
Posted: 30th Nov 2004 21:05
I would like to take a look at the mathematical way of doing this (as this usually ends up being more efficent than an object-specific method)

Anyone willing to lend a hand?

Screw the rules...what can i blow up?
Pyro_guy
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: England
Posted: 1st Dec 2004 20:44
perhaps not...

I've found a method that produces the effect I want, although rotating the camera is out of the question.

Basically, it involves getting the OBJECT SCREEN X and OBJECT SCREEN Y values, then testing them against the current mouse position on the 2d screen. if the object y position is greater than the mousey then decrease the object y position etc...

I'll post some code if I have time

Screw the rules...what can i blow up?

Login to post a reply

Server time is: 2024-11-27 16:30:19
Your offset time is: 2024-11-27 16:30:19