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
haliop
User Banned
Posted: 16th Dec 2013 11:00
hi im having a little trouble with projecting
3d objects from 2d objects..

meaning i want to use physics for 3d objects.. so i place the 3D object somewhere in the world and it also have a 2D sprite attached to it with physics so when it falls down it collides with other 2d/3d sprites/objects ...
but i cant get the locations of the 3d to be exact
the camera is not on 0,0,0 and that might be the problem, any ideas?
i know there are some tuts here on the forum and i tried to work out baxlash 3d car example but honestly math is the worst side of me :/

if anyone can help with a small code example that would be extremely helpful.

thank you for your time, nadav.

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 16th Dec 2013 11:44
I have tried mixing 2D and 3D visuals, and it's not ideal, the screen resolution plays a big part and it doesn't seem to take much to upset it.

But I don't think there would be a big issue with using sprites for collision, having them off screen and hidden, really though you need to give more detail, or provide a code example of your problem, then someone will figure it out. I think that's the best way to understand a solution, provide the problem in code form for people to fix, rather than hoping that whatever someone comes up with is relevant enough.

I am the one who knocks...
haliop
User Banned
Posted: 16th Dec 2013 11:56 Edited at: 16th Dec 2013 12:15
ok i'll work a code right now

i think i found the problem
instead of placing 3d then attach a 2d physic-ed sprite to it
i did it the other way around..

so im trying now to create a 3d object and they attach a 2d sprite to it instead of what i did.. i'll see how it goes if i wont succeed i will post here the problem

haliop
User Banned
Posted: 16th Dec 2013 13:02
ok this is where im stuck

camera positions are not on 0,0,0
when you pick a sprite/object you can see clearly that the positions are about as good as it gets but when you release the mouse button it falls (in 3d) somewhere else and i need it to fall exactly where i last picked it, i know its just something im missing here again im not good at math and i should really consider taking a course ...



haliop
User Banned
Posted: 16th Dec 2013 16:39
anyone ? maybe there is another way to do this?
use 2D physics with 3D objects ?

lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 16th Dec 2013 17:20
I'm attaching an old test I did. It's pretty straight forward.

The only thing I can think of right now is you have to invert the Y value from 2d to 3d. That is if you've positioned the camera and everything so that X is left/right and Y up/down and Z for depth, otherwise use inverted Y from 2d positions as Z.

Well check it out and feel free to ask me why it works, I haven't looked at it in a long while.

My hovercraft is full of eels

Attachments

Login to view attachments
haliop
User Banned
Posted: 16th Dec 2013 17:56
i dont get it..
i already looked at baxslash 3d car tutorial
y is already inverted in my app
but still 3D world is diffrent then 2D world maybe i should try to play with the offsets of the 2d world see where it goes.

bahh an entire day and no solution
my head hurts

lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 16th Dec 2013 18:25
There is absolutely no math in the example I attached.

Getting the mouse to interact is a different thing. You can't really expect to keep the 2d and 3d at the same scale and never move the camera in 3d, there would be no point in even having it 3d. So you most likely have to check in 3d world where the mouse is.

My hovercraft is full of eels
haliop
User Banned
Posted: 16th Dec 2013 18:45
yeah i think i did it the other way around...


so im after a simple solution where
you have 3d objects that can be picked as shown in the example
then when you release them 2d physics kicks in , in AppGameKit v2 i would have done it with 3D physics which will be very cool... but now i just cant figure out why just adding 3d world x offset dosent work...

Login to post a reply

Server time is: 2024-11-24 23:29:31
Your offset time is: 2024-11-24 23:29:31