Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Ayumi, NewbieZorro, TipmyPip), 13,887 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
[SOLVED] Which side of the dice... #332640
07/11/10 11:44
07/11/10 11:44
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
I can't able to figure out this algorithm. I have a semi-working one.
There is a 6 side dice.
In the starting position i can see the side A.
If its rotated from right to left i can see the side B, C, D.
If its rotated from top to bottom i can see the side E.
If its rotated from bottom to top i can see the side F.
You can't use the skin to help the algorithm.
What algorithm is able to recognize which side i can see after any rotation?

i tried to enter an image, i don't understand why didn't appear that...
example image

Last edited by Aku_Aku; 07/11/10 14:38.
Re: Which side of the dice... [Re: Aku_Aku] #332643
07/11/10 11:47
07/11/10 11:47
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
add 6 vertex (1 to each side)
get they´r position vith vec_for_vertex.. ask the Z-value and you got the side that is shown up.


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Which side of the dice... [Re: Espér] #332644
07/11/10 11:49
07/11/10 11:49
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
I wrote, and i write again:
DON'T USE any skin or vertex or vortex or cortex or bartex or any other ex-ended help.
mad

Re: Which side of the dice... [Re: Aku_Aku] #332650
07/11/10 12:56
07/11/10 12:56
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
If the position of any face has the coordinates x0, y0, z0 in the start position, and the dice is rotated by the angles pan, tilt, roll the coordinates are as follows:

x = (x0*cos(pan) + y0*sin(pan))*cos(tilt) + z0*sin(tilt)
y = (x0*sin(pan) + y0*cos(pan))*cos(roll) + ((x0*cos(pan) + y0*sin(pan))*sin(tilt) + z0*cos(tilt))*sin(roll)
z = (x0*sin(pan) + y0*cos(pan))*sin(roll) + ((x0*cos(pan) + y0*sin(pan))*sin(tilt) + z0*cos(tilt))*cos(roll)

You can then check the coordinates of each face and look which is at the top.

BUT, the engine can do these calculations for you, if you use vec_for_vertex like Espér said. Why are you so against it? Look at the complexity of these formulas and how easy if would be with vec_for_vertex!

Last edited by Lukas; 07/11/10 14:51. Reason: Corrected a * to a +
Re: Which side of the dice... [Re: Lukas] #332654
07/11/10 13:10
07/11/10 13:10
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline
Serious User
Rackscha  Offline
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
Year Aku,
its so simple with engine related functions, dont make your life harder o.O


MY Website with news of my projects:
(for example my current
Muliplayer Bomberman,
GenesisPrecompiler for LiteC
and TileMaster, an easy to use Tile editor)
Sparetime-Development

Re: Which side of the dice... [Re: Lukas] #332664
07/11/10 14:07
07/11/10 14:07
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
I am really sad, i don't understand your solution with coordinates x0, y0, z0...

OK, i accept your advice, if you give me the solution how to put 6 vertex (1 to each side) to an entity after it is loaded into.
Moreover i don't know that vec_for_vertex and i don't know how should use it and its result.

Last edited by Aku_Aku; 07/11/10 14:08.
Re: Which side of the dice... [Re: Aku_Aku] #332667
07/11/10 14:14
07/11/10 14:14
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
uhm..

open MED => select vertex Mode => click on "Create vertex" icon => Place vertex to the model (leftklick = creating)

Then just place the vertex right, and note his ID

The ID is shown in the lower right of the MED Window, after selecting one vertex.
Shown like this (ABCD == the ID number you need to write down):
Code:
Vertex #ABCD




now just use vec_for_vertex with the Vertex IDs...


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Which side of the dice... [Re: Espér] #332669
07/11/10 14:30
07/11/10 14:30
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
Thanks for your patience Espér.

I am really sorry, but i can't open the MED inside processing a lite-c script by the engine, and execute your advice and save the model and reaload. And moreover continue the running of the script.

I tried it explain in my starting post, it is a pity, nobody can't understand... (it was a really simple sentence)

The happier end of this thread is that, i have the fully working solution, naturally in lite-c.
No MED, no WED, only the engine and script.

Last edited by Aku_Aku; 07/11/10 14:33.
Re: Which side of the dice... [Re: Aku_Aku] #332670
07/11/10 14:33
07/11/10 14:33
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Aku....

You know that you load the model... edit the vertex.. and save it.. BEFORE you start the script? not while running....


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Which side of the dice... [Re: Espér] #332672
07/11/10 14:41
07/11/10 14:41
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
I can't do it with all of the more than two thousend models, and with those they will be made in the future by any others...
I need a generic solution for that case, me and the script don't know the model, and the model can't modify for the sake of any unknown outer circumstances...
Luckily, i outhammered the generic solution without modifying the models.

Last edited by Aku_Aku; 07/11/10 14:43.
Page 1 of 2 1 2

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1