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 / Flip a 3D object

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Feb 2019 06:31
Is it possible (Without mesh memblocks) to flip an object?
Like flipping a sprite
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Feb 2019 08:03
do you mean like SetObjectMeshUVOffset( objID, meshIndex, textureStage, offsetU, offsetV )
fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Feb 2019 08:06
I need it to flip everything. Textures, normals, verts. The whole box and dice
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Feb 2019 08:10
unless theres a new command not in the help the only way I can think of is using a memblock
fubar
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Feb 2019 08:12
Yeah. I think so. Maybe i'll just flip it in my 3D proggy
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Feb 2019 08:14
I wonder what would happen if SetObjectScale( objID, -1,-1,-1 )
fubar
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 08:17
Yeah this is the way!
Setobjectscale(obj,-1,-1,-1)
I'm not a grumpy grandpa
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Feb 2019 08:21
just tried




It isn't really noticeable being a box but it didn't error what I noticed tho the edges seemed darker
perhaps because its showing inside faces but if the texture is set to texture stage 1 instead of 0 it might work
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Feb 2019 08:55

this demonstrates difference
i
fubar
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 09:04 Edited at: 22nd Feb 2019 09:05
Yes it works but somehow we have to invet the normals, and will need to use memblock...but that is easier than we think.

Here's my example without memblock .


I'm not a grumpy grandpa

Attachments

Login to view attachments
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Feb 2019 09:09
Thanks guys. That is awesome!!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 09:12 Edited at: 22nd Feb 2019 09:14
You are welcome !

Here's the code that fix the normals .



I'm not a grumpy grandpa

Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Feb 2019 09:21
great code chafari
I also noticed if you don't want it flipped on y the following changes works
setobjectscale(2,-1,1,-1)
SetMeshMemblockVertexnormal(mesh,i,-nx#,ny#,-nz#)
fubar
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 10:05
Thanks fubarpk for testing

Quote: "I also noticed if you don't want it flipped on y the following changes works
setobjectscale(2,-1,1,-1)
SetMeshMemblockVertexnormal(mesh,i,-nx#,ny#,-nz#)"


Yeah...the same tha Dbpro ....but just tested here with Agk and if I do what you suggested it won't reverse the box....I suppose it must be the way different Graphic Cards work. So we never know what user finally will see on screen
I'm not a grumpy grandpa
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Feb 2019 20:32
Super awesome guys. Thanks so much
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 22nd Feb 2019 21:07
If you invert it, aren't you technically showing the backs of the faces? If so, raycasting and Collison may not work as the help says only front faces will be detected, something to be aware of.
puzzler2018
User Banned
Posted: 22nd Feb 2019 21:12 Edited at: 22nd Feb 2019 21:13
i agree.. the normals will need to be changed opposite too

nx#=-nx#
ny#=-ny#
nz#=-nz#

Or negative normals too, Will Paul be able to create a function and implement it on the next round or make the function ourselves.

Who is up for that challenge lol!!!
Tier 1 Developer
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Feb 2019 21:26
Unfortunately flipping the normals doesn't seem to work for my .3ds model.
I have attached the project if anyone wants to have a crack at fixing it

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 22nd Feb 2019 21:31 Edited at: 22nd Feb 2019 21:32
Awesome tank wheels lol

Ill quickly take a look tomorrow 21:30 here and need to chill - getting tired- sorry
Tier 1 Developer
puzzler2018
User Banned
Posted: 22nd Feb 2019 21:36
Try


Tier 1 Developer
puzzler2018
User Banned
Posted: 22nd Feb 2019 21:38

Tier 1 Developer
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Feb 2019 21:47
Almost. The cogs (iltm) still need to be flipped
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 22:10
Try this one....I think works Ok here.
I'm not a grumpy grandpa
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Feb 2019 22:20
Ok
Thanks
I will look at it later in
puzzler2018
User Banned
Posted: 22nd Feb 2019 22:27
Its a little tough cookie - get one with something else whilst we figure it out


Tier 1 Developer
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 22:27 Edited at: 22nd Feb 2019 22:30
Quote: "If you invert it, aren't you technically showing the backs of the faces?"


Not really....front or back faces deppend on how they where made clockwise or anticlockwise . The normals are only for the lights....setobjectcullmode works in the same way ...we can decide if the faces must be seeing from inside or outside ...collisision keep working correctly .


Edit
Quote: "Its a little tough cookie - get one with something else whilst we figure it out"


doesn't it work on your computer ?
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 22nd Feb 2019 22:29
No- I think Blin0K requires the outside tracker wheels to appear as welll as the inner wheels too

Tier 1 Developer
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 22:33
puzzler ...have you tried my last code?
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 22nd Feb 2019 22:39
Nothing to with normals - its the vertexes mainly

eg Left

Vertex 1
Vertex 2
Vertex 3

Vertex 3
Vertex 1
Vertex 4

We need to swap

Right

Vertex 1
Vertex 3 // swap
Vertex 2 // swap

Vertex 3
Vertex 4 // swap
Vertex 1 // swap

A little tough one for the time we have

Again - who would like this challenge unless paul can do something quick for you
Tier 1 Developer
puzzler2018
User Banned
Posted: 22nd Feb 2019 22:41
Yes chafari and there should be wheels where the yellow patch is on this screen shot
Tier 1 Developer

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 22nd Feb 2019 22:47 Edited at: 22nd Feb 2019 22:48
Unless you make 2 objeects for the wheels loaded

1 set rotated at 0 and applied to left of each track

1 set rotated at 180 and applied to right of each track - but the UV offset is negative amount

that would be the finest and fastest solution

Im knackered so will send something in the morning along these lines
Tier 1 Developer
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 22:49 Edited at: 22nd Feb 2019 22:50
I know what you mean puzzler but it must be something about the different graphic cards...this is what I see here .


I'm not a grumpy grandpa

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 22nd Feb 2019 22:55
I get the same - do you see a blank space inside the track wheels?

I think want here is a double wheeled track. instead of blank space in the in the wheels

like this (attahced)- Sorry its a really shabby drawing

Swap vertexes!!



Tier 1 Developer

Attachments

Login to view attachments
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 23:00
What I see in screen is exactly like the animated gif
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 22nd Feb 2019 23:02 Edited at: 22nd Feb 2019 23:04
exactly - i think required here is wheels showing on each side of a single track and then double the track up to make tank wheels

for the minute just think of one tank track.. with wheels showing on left and right of it

Lets do that first...
Tier 1 Developer
puzzler2018
User Banned
Posted: 22nd Feb 2019 23:14
Who knows how to flip vertexes on an object to have face in front instead of behind... Advised a bit back - Cause i need sleep shortly so cant do it right now
Tier 1 Developer
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 23:17 Edited at: 22nd Feb 2019 23:23
To flip a 3D object we just need to scale object -1-1-1 then set object cullmode 0

Edit
What I did here, is just rotate some pieces of the tank to see it correctly. I made an animated gif showing the same as Blink0k but without the culled faced in second caterpillar .
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 22nd Feb 2019 23:21
Spot on - that will work - i must not forget that blooming command - you done for internal spheres made for own skyboxes -dam cull mode

Tier 1 Developer
puzzler2018
User Banned
Posted: 22nd Feb 2019 23:25
Just tried it...

You Try it....

Enjoy the challenge.

Music time now


Tier 1 Developer
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 22nd Feb 2019 23:28 Edited at: 22nd Feb 2019 23:29
let's try

I'm not a grumpy grandpa

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 22nd Feb 2019 23:30 Edited at: 22nd Feb 2019 23:32
You mean lets try an

FlipObject(objID, Horizontal, Vertical)

command you mean......

Yeah for sure.....
Bring it on

when do we need it by - Yesterday lololol
Tier 1 Developer
puzzler2018
User Banned
Posted: 22nd Feb 2019 23:33 Edited at: 22nd Feb 2019 23:37
nope... Still no inner wheels on the inside of the tracks.


Chafari.... We need to swap vertexes - please listen.... please. please

It cannot be done with the commands we have..



We can see the inner wheels of this tank... I beleive Blink0K wishes the same
Tier 1 Developer
puzzler2018
User Banned
Posted: 22nd Feb 2019 23:41
Who is up for the challenge...
Tier 1 Developer
puzzler2018
User Banned
Posted: 22nd Feb 2019 23:45 Edited at: 22nd Feb 2019 23:48
To invert a triangle is

Triangle point 1
Triangle point 2
Triangle point 3

inverted is

Triangle point 1
Triangle point 3
Triangle point 2

Dont forget the UVs

If I just did it then wouldnt be an exciting learning experience. - so im not going to

Instead im going to learn you the methods of memblocks
Tier 1 Developer
puzzler2018
User Banned
Posted: 22nd Feb 2019 23:53
Anyone interested????
Tier 1 Developer
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Feb 2019 00:10
I'm on it...
I'm not a grumpy grandpa
puzzler2018
User Banned
Posted: 23rd Feb 2019 00:13
Awesome.. my good fellow - i know you wont let us down, your a great programmer.
Tier 1 Developer
puzzler2018
User Banned
Posted: 23rd Feb 2019 00:16
Where is the achievements if some poor soul did it for us.
Tier 1 Developer
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Feb 2019 00:29 Edited at: 23rd Feb 2019 00:30
Here's my last update .






I'm not a grumpy grandpa

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 23rd Feb 2019 00:33
congratulations - you onto the winner
Tier 1 Developer

Login to post a reply

Server time is: 2024-11-05 22:51:28
Your offset time is: 2024-11-05 22:51:28