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 Studio Chat / [SOLVED] how to use memblock function to create a simple mesh cube?

Author
Message
Yiu435
3
Years of Service
User Offline
Joined: 19th Dec 2020
Location:
Posted: 2nd Jun 2023 07:06 Edited at: 2nd Jun 2023 07:07



This code from the example document creates a colour triangle.
My question is that how to create a simple cube using memblock function?

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

Go to answer

blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Jun 2023 03:21 Edited at: 3rd Jun 2023 03:22
There are a number of functions that begin with SetMeshMemblock that will help you set the memblock values.
I have attached a .obj format 3D object which AppGameKit can load. It is a textfile that you can examine with notepad and should give you a good idea of how you arrange the verts and faces for a box.
You could use AppGameKit to load the model, convert it to a memblock and then examine the memblock to see how it is formed and how the memblock relates to the .obj file

Attachments

Login to view attachments
Yiu435
3
Years of Service
User Offline
Joined: 19th Dec 2020
Location:
Posted: 3rd Jun 2023 08:55
thanks,i will try from my side using your advice, hope I can figure it out.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 4th Jun 2023 07:23
the easiest way is to


where
objID - The ID of the object containing the mesh to read
meshIndex - The index of the mesh to copy into a memblock
memID - The ID of the new memblock

then use methods in this one to work out what vertice you want to change if thats your aim

this thread of mine has several memblock functions that may be of use
https://forum.thegamecreators.com/thread/222027

creating objects from memblocks can be tricky and theres alsorts of maths involved
fortunately agk has allot of built in functions that simplify the process

GOODLUCK
fubarpk
https://fubarpk.itch.io/
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 4th Jun 2023 16:18
This post has been marked by the post author as the answer.
I found an example in my library which is probably from this forum.

Here's the code:



PSY LABS Games
Coders don't die, they just gosub without return
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 23rd Jul 2023 21:48 Edited at: 24th Jul 2023 05:38
Hey Thanks
@Psy
what about the more creating more complicated shapes ?

could you provide code say to make a "H" shape
say about 1 inch long with closed ends

thank you in advance
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 24th Jul 2023 03:17
Just found the original post by TomToad. He also provides the code for creating a simple cube using these function.s That should get you started:

https://forum.thegamecreators.com/thread/221755#msg2620539




PSY LABS Games
Coders don't die, they just gosub without return

Login to post a reply

Server time is: 2024-04-26 19:14:17
Your offset time is: 2024-04-26 19:14:17