Can't Raycast into TreeCollisions

maclaeden

17-04-2008 09:15:05

I'm trying to create a body for a wall and cast rays at it, but I never get an intersection.

self.newtonWorld = OgreNewt.World()

walls = self.sceneManager.createEntity("Walls", "Tube01.mesh" )
wallnode = e.getParentSceneNode().createChildSceneNode(ogre.Vector3(50, 0, 0))
wallnode.attachObject( walls )
walls.setMaterialName( "Masonry.Stone.Marble.Square.Stacked.Polished.White-Brown-Black" )

col = OgreNewt.TreeCollision( self.newtonWorld, wallnode, True )
bod = OgreNewt.Body( self.newtonWorld, col )
del col
res = bod.attachToNode( wallnode )


And here's my raycasting code:

camray = self.camera.getCameraToViewportRay(0.5,0.5)
start = camray.getOrigin()
end = camray.getPoint( 10000.0 )
self.ray = OgreNewt.BasicRaycast( self.newtonWorld, start, end )
info = self.ray.getFirstHit()
print info.mDistance #always = -1


Am I doing anything wrong?

walaber

19-04-2008 04:56:24

the ray is exceeding the world limits.

the Newton World object defaults to a size from (-100, -100, -100) to (100, 100, 100). you need to either reduce the length of the ray, or increase the size of the World.

Danaugrs

15-07-2008 21:37:05

How can I increase the size of the world?
It doesn't seem to be in the Newton docs...
Thanks in advance,
Danaugrs

Danaugrs

16-07-2008 01:34:19

I solved my problem by making everything smaller :)
but it would still be useful to know how to change the world size

ProfesorX

16-07-2008 02:03:23

How can I increase the size of the world?
It doesn't seem to be in the Newton docs...
Thanks in advance,
Danaugrs


Yes, it is there.

In newton:

NewtonSetWorldSize()

in OgreNewt:

World::setWorldSize()

Danaugrs

16-07-2008 13:28:21

Yes it is there, my mistake :oops:
I got the docs from the NewtonSDK in .chm
but where can I find the OgreNewt docs?
For example, the Body class member "attachToNode" isn't in the Newton docs, but in OgreNewt docs I suppose?
It looks to be a linking function that connects Newton to Ogre.

dudeabot

17-07-2008 02:53:12

whe you download ogrenewt, there are some demos that come with it

ProfesorX

17-07-2008 04:01:11


but where can I find the OgreNewt docs?


inside the doc folder in the ogrenewt sources (SVN) there is a doxygen script to generate the documentation in html format.

Danaugrs

21-07-2008 14:56:58

Got it! :D

http://walaber.com/index.php?action=showitem&id=9

Thanks a lot!