Hello,
I am creating a LineSegs object that has some funny behavior.
In this program, both linesegs appear behind the card ‘c1N’. But when the last two lines are commented out, the green line appears in front as expected.
import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from panda3d.core import *
cm = CardMaker('card')
c1N= cm.generate( )
c1= NodePath( c1N )
c1.setPos( 0, 0, 0 )
c1.copyTo( render )
linesrandR= LineSegs( 'linesrand' )
#green: lower left to top right
linesrandR.setColor( 0, 1, 0, 1 )
linesrandR.moveTo( -1, -.1, -1 )
linesrandR.drawTo( 2, -.1, 2 )
#red: lower right to top left
linesrandR.setColor( 1, 0, 0, 1 )
linesrandR.moveTo( 2, .1, -1 )
linesrandR.drawTo( -1, .1, 2 )
linesrandN= linesrandR.create( )
linesrand= NodePath( linesrandN )
linesrand.reparentTo( render )
base.cam.setPos( 0, -10, 0 )
base.cam.node( ).setLens( OrthographicLens( ) )
base.cam.node( ).getLens( ).setFilmSize( 5, 5 )
run( )
In a slight variation, both linesegs appear in front of the card, until the last two lines are commented out. The linesegs don’t move behind the card until their Y-coordinate is around +0.5, slighty larger.