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.

AppGameKit Classic Chat / [3D] Y Position problems

Author
Message
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Dec 2015 08:59 Edited at: 15th Dec 2015 09:04
I am suffering from severe code blindness!

What I want to achieve is this: Create a 3D plain where the first 2 vertices share the same height (Y position) and the second 2 vertices share the same height (but may be different from the first 2). In this image, vertices 0 and 1 should be the same and vertices 2 and 3 should be the same. The white bar is perfectly horizontal, so should not cut through the plains at an angle!



The texture is designed to show the vertex numbers

Here is the code for positioning the vertices.


You should be able to see the method to position the vertices, I use a cube, which I position and record the values in the mesh memblock.
Most importantly, I use the same Y value (point[n].y) for 0 and 1, and the same Y value (point[n+1].y) for 2 and 3.
So how is it different in the final result?!?!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Attachments

Login to view attachments
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 15th Dec 2015 10:00
Have you tried changing the vertex order? Something like:

V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 15th Dec 2015 11:40
Possible bug:

i have a small sample to test how mush to gain from mesh batching.



Tried to add +y to the SetMeshMemblockVertexPosition Z pos , and it looks like it change the Y , so perhaps SetMeshMemblockVertexPosition has swapped Y and Z , X look fine.
Please confirm by changing your sample by swapping Y,Z when using SetMeshMemblockVertexPosition.

BTW: if you batch meshes using AddObjectMeshFromMemblock , you gain a 100% increase in speed , yes 100% , but i assume your making one large object , so you will not have this problem.


best regards Preben Eriksen,

Attachments

Login to view attachments
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Dec 2015 12:07
Thanks for the suggestions.

Quote: "Have you tried changing the vertex order?"

I have checked that the vertices match the texture (and therefore in the right place) by moving them outwards, one by one. That way I could see that each one was where I expect it to be.

Quote: "Please confirm by changing your sample by swapping Y,Z when using SetMeshMemblockVertexPosition."

This didn't fix it, I got an unrecognisable mashup of shapes.
Perhaps you made the same mistake as I did, and thought a Plane is a horizontal shape? It is actually created vertically.

Quote: "BTW: if you batch meshes using AddObjectMeshFromMemblock , you gain a 100% increase in speed , yes 100% , but i assume your making one large object , so you will not have this problem."

Thanks for the information. Step 1 is creating individual objects, but then I will move to meshes which combine 100 Planes into 1 object. Good to know this will improve performance.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 15th Dec 2015 14:19 Edited at: 15th Dec 2015 14:21
My bad:
Im rotation the object , but rotation dont change the vertex , so when i rotate x by 90 to place the plane vertically , then when i change the vertex z if will actually look like it move along y. Its a bit confusing when your also rotating objects. ( screenshot when i dont rotate x it actually move in the z direction , so SetMeshMemblockVertexPosition is fine ).

Anyway perhaps you have some of the same using rotation.
best regards Preben Eriksen,

Attachments

Login to view attachments
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 15th Dec 2015 15:44 Edited at: 15th Dec 2015 15:45
I don't mean to hijack, but why do I keep seing .png attachments as grabled text? Is this a problem with the boards or is it just my browser? I can't see your attachment Preben, just a page full of ascii... [edit] but I CAN see your previous attachment (https://forum.thegamecreators.com/attachment/76818).
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 15th Dec 2015 16:24 Edited at: 15th Dec 2015 16:24
Quote: "attachments as grabled text?"

Must be a forum thing , the small thumb is working. i upladed a jpg instead and its working. i will keep the png if anyone want to find out why it dont display
best regards Preben Eriksen,
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Dec 2015 16:28
My Jpg didn't work either. I had to host the upload on my webspace.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th Dec 2015 08:41
I solved my problem, the problem was me.
I was using a cube to calculate my rotation and positioning. I had incorrectly positioned the cube when doing the LookAt to get the angle., and all plains were being warped.

Thanks for your efforts as always.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-04-20 09:42:52
Your offset time is: 2024-04-20 09:42:52