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.

Dark Physics & Dark A.I. & Dark Dynamix / Bullet Decal: Position + Rotate using Dark Physics

Author
Message
Dark Fire
14
Years of Service
User Offline
Joined: 23rd Jun 2008
Location: In the code you write
Posted: 27th Oct 2009 19:50
I tried to get the normals using dark physics commands but the normals return something confusing.

This seems like it would work in theory. If the normals would actually return the normal it should work.

Here is the source to understand what the normals are returning:


There are several things I am trying to do:
- Create decals and position and rotate them against any object
- Deform the decal to shape to the object (adjust vertexdata)
- Paint the decal on the object as an alternative using the tu and tv (texture u and v)

I don't entirely understand how to use the Phy Ray Cast All Shapes the correct way so that the normals returned work for my example. I tried a technique that someone from the forums suggested.

Tersculpt paints textures on an object. I am trying to figure out how to do this with decals. This would be the technique I would use if I can figure out how to get it to work. First I have to understand the Phy Ray Cast All Shapes command before I can start working on a way of adding my decal image to the object's texture.

I have been looking though the forums for an answer for a long time and no one seems to have one quite yet. I have tried several attempts at this with no luck.

I tried using a sphere positioning and rotating it so it is in front of the camera at all times. (fixed to the camera)

then:


I know that I can use normalize vector to get the normals and just use that, but I want to use Dark Physics instead. The raycasting was made for a reason and I want to learn how to use it.

I know I can use sparkies collision dll as well, but it is to much extra code on top of using physics. (so lower fps, more looping time, ect ect ect)

Any help would be appriciated.

Thanks,

Dark Fire

My future self met up with one day to teach me what I know today.
HowDo
20
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 27th Oct 2009 20:27
If I said the values returned by ray cast are form the center of the object would that help, change the size to 10 then you'll see whats going on.

Dark Physics makes any hot drink go cold.
Dark Fire
14
Years of Service
User Offline
Joined: 23rd Jun 2008
Location: In the code you write
Posted: 28th Oct 2009 17:28
If you were to click on the face of the object on my example (without moving the camera) then it would return: X: 0, Y: 0, Z: -1 for the normals. What does this mean?

Thanks,

Dark Fire

My future self met up with one day to teach me what I know today.
HowDo
20
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Oct 2009 18:45 Edited at: 28th Oct 2009 19:10
it returns the face number or position of that face on the screen

try rotating object 1 and see what you get, or fly the camera to the back.




I think it saying
z=-1 is front
z=1 is back
x=-1 is left
x=1 right
y=-1 is top
y=1 is bottom.

Quote: "float = phy get ray cast hit normal x ( ), the normal ( direction ) where the impact took place on the X axis
float = phy get ray cast hit normal y ( ) , the normal ( direction ) where the impact took place on the Y axis
float = phy get ray cast hit normal z ( ) , the normal ( direction ) where the impact took place on the Z axis "


from the reference docs

Dark Physics makes any hot drink go cold.
Dark Fire
14
Years of Service
User Offline
Joined: 23rd Jun 2008
Location: In the code you write
Posted: 29th Oct 2009 01:20
How does this help me when I am trying to rotate to a certain face of a complex object such as a sphere?

Thanks,

Dark Fire

My future self met up with one day to teach me what I know today.
HowDo
20
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 29th Oct 2009 15:22
have a look at this link as I think someone worked it out, even if its not what you need it might have something useful in it.

http://forum.thegamecreators.com/?m=forum_view&t=133881&b=30

Dark Physics makes any hot drink go cold.

Login to post a reply

Server time is: 2023-02-01 12:04:14
Your offset time is: 2023-02-01 12:04:14