WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-27-2008, 08:09 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Unhappy walkto plays no animation...

Hi,

Could someone help?

Code:
male.act(vizact.walkto([3,0,8], 10.5, 90, walkAnim=male.getAnimationID('male_walk.cax')))
and

Code:
male.act(vizact.walkto([3,0,8], 10.5, 90, 2))
Both code move my character to new location, but no animation is being played. Did I do something wrong?

Kind Regards,
Iwan
Reply With Quote
  #2  
Old 04-27-2008, 08:15 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Red face It's working...

Wait... It's working now?!?!?!

Kind Regards,
Iwan
Reply With Quote
  #3  
Old 04-27-2008, 08:42 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Unhappy It's not working...?

I pasted my code here. The guy is supposedly running around making a big circle, but he only stretches his arms while sliding around.

Code:
import viz
import math

iwan = []
for i in range(20):
	n = [math.sin(i)*1, 0, math.cos(i)+1]
	iwan.append(n)
	
print iwan

male = viz.add('male.cfg')
male.idlepose(12) #Use animation 12 as the idle pose

for each in iwan:
	print "male.act(vizact.walkto(",each,"))"
	male.addAction(vizact.walkto(each, 1.5, 90, 2)) # 2=walking anim
	
if __name__ == "__main__":
	viz.go()
Could someone tell me where the mistakes that I made in my script?
Thank you very much.
Reply With Quote
  #4  
Old 04-28-2008, 11:21 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The vizact.walkto command does not accept lists for the position. This will be fixed in a future release. For now you must use the following code instead:
Code:
vizact.walkto(each[0],each[1],each[2], walkSpeed=1.5, turnSpeed=90, walkAnim=2)
Reply With Quote
  #5  
Old 04-28-2008, 06:48 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Red face Thank you...

Hi,

Thank you. Why didn't I try that before?
I will keep in mind that "vizact.walk" does not accept lists to specify position.

Have a great day.
Reply With Quote
  #6  
Old 05-02-2008, 04:50 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Unhappy walkTo ... does not reach final destination....

Hi,

I used for loops to read geometries that define the walkTo's coordinates.
Vizard read them okay. Please see the terminal window. However, Vizard did not finish the movement properly. The ducks are 1 coordinate behind the final destinations.

I did try to type in the last command to force the duck to go to the final destination, but it didn't do anything.

The coordinates are all in order, I did not missed a single one.

Could someone point out where did I (possibly) go wrong?

Kind Regards,
Iwan
Attached Thumbnails
Click image for larger version

Name:	walkTo_missed.jpg
Views:	851
Size:	498.4 KB
ID:	236  
Reply With Quote
  #7  
Old 05-02-2008, 05:03 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Can you post a sample script that reproduces the problem? It's difficult to tell what the problem is by looking at the screenshot.
Reply With Quote
  #8  
Old 05-03-2008, 12:38 AM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Red face Action sequence code.....

Here is the module that load the objects file and set-up the movements...

Code:
import viz
import vizact

#Ant 7(normal), 8 (stilts)and 9(stumps) are for scene 2
ant7 = viz.add('duck.cfg')
ant7.setScale(0.02,0.02,0.02)
ant7.idlepose(2)
ant7.disable(viz.RENDERING)
ant7.setPosition([1.000, 0.00, 0.000])
ant7.setEuler([90,0,0])

ant8 = viz.add('duck.cfg')
ant8.setScale(0.02,0.02,0.02)
ant8.idlepose(2)
ant8.disable(viz.RENDERING)
ant8.setPosition([1, 0.0, -0.200])
ant8.setEuler([90,0,0])

ant9 = viz.add('duck.cfg')
ant9.setScale(0.02,0.02,0.02)
ant9.idlepose(2)
ant9.disable(viz.RENDERING)
ant9.setPosition([1.000, 0.0, -0.4])
ant9.setEuler([90,0,0])


#Loading .OSG files that contains movement points of the ants
movementPaths = viz.add('antMovementPoints.osg')

#Setting up foraging path of normal condition in scene 4
CP_ACTOR_CONTROL = []

CP_COUNT_ACTOR_CONTROL = 45
CONTROLPOINT_ACTOR_CONTROL_PREFEX = 'control.path.'  #name of boxes = layera1 ... layera17
CONTROLPOINT_ACTOR_CONTROL_SUFFEX = ''  #use '_Cube' for .obj and '' for.osg

for cpNumber in range( 0,CP_COUNT_ACTOR_CONTROL):	
	nodename = '%s%03d%s' % (CONTROLPOINT_ACTOR_CONTROL_PREFEX, cpNumber,CONTROLPOINT_ACTOR_CONTROL_SUFFEX)
	pointNode = movementPaths.getChild(nodename)
	nodebox = pointNode.getBoundingBox()
	cntr = [nodebox.center[0],-nodebox.center[2],nodebox.center[1]]  #this is the xyz setting ONLY for .OSG file
	print 'control.path.',cpNumber, cntr
	CP_ACTOR_CONTROL.append(cntr)

#Setting up foraging path of stilts condition in scene 4
CP_ACTOR_STILTS = []

CP_COUNT_ACTOR_STILTS = 45
CONTROLPOINT_ACTOR_STILTS_PREFEX = 'stilts.path.'  #name of boxes = layera1 ... layera17
CONTROLPOINT_ACTOR_STILTS_SUFFEX = ''  #use '_Cube' for .obj and '' for.osg

for cpNumber in range( 0,CP_COUNT_ACTOR_STILTS):	
	nodename = '%s%03d%s' % (CONTROLPOINT_ACTOR_STILTS_PREFEX, cpNumber,CONTROLPOINT_ACTOR_STILTS_SUFFEX)
	pointNode = movementPaths.getChild(nodename)
	nodebox = pointNode.getBoundingBox()
	cntr = [nodebox.center[0],-nodebox.center[2],nodebox.center[1]]  #this is the xyz setting ONLY for .OSG file
	print 'stilts.path.',cpNumber, cntr
	CP_ACTOR_STILTS.append(cntr)


#Setting up foraging path of stumps condition in scene 4
CP_ACTOR_STUMPS = []

CP_COUNT_ACTOR_STUMPS = 45
CONTROLPOINT_ACTOR_STUMPS_PREFEX = 'stumps.path.'  #name of boxes = layera1 ... layera17
CONTROLPOINT_ACTOR_STUMPS_SUFFEX = ''  #use '_Cube' for .obj and '' for.osg

for cpNumber in range( 0,CP_COUNT_ACTOR_STUMPS):	
	nodename = '%s%03d%s' % (CONTROLPOINT_ACTOR_STUMPS_PREFEX, cpNumber,CONTROLPOINT_ACTOR_STUMPS_SUFFEX)
	pointNode = movementPaths.getChild(nodename)
	nodebox = pointNode.getBoundingBox()
	cntr = [nodebox.center[0],-nodebox.center[2],nodebox.center[1]]  #this is the xyz setting ONLY for .OSG file
	print 'stumps.path.',cpNumber, cntr
	CP_ACTOR_STUMPS.append(cntr)



#Setting up homebound path of normal condition in scene 4
CP_ACTOR_CONTROL_RETURN = []

CP_COUNT_ACTOR_CONTROL_RETURN = 45
CONTROLPOINT_ACTOR_CONTROL_RETURN_PREFEX = 'control.Rpath.'  #name of boxes = layera1 ... layera17
CONTROLPOINT_ACTOR_CONTROL_RETURN_SUFFEX = ''  #use '_Cube' for .obj and '' for.osg

for cpNumber in range( 0,CP_COUNT_ACTOR_CONTROL_RETURN):	
	nodename = '%s%03d%s' % (CONTROLPOINT_ACTOR_CONTROL_RETURN_PREFEX, cpNumber,CONTROLPOINT_ACTOR_CONTROL_RETURN_SUFFEX)
	pointNode = movementPaths.getChild(nodename)
	nodebox = pointNode.getBoundingBox()
	cntr = [nodebox.center[0],-nodebox.center[2],nodebox.center[1]]  #this is the xyz setting ONLY for .OSG file
	print 'control.Rpath.',cpNumber, cntr
	CP_ACTOR_CONTROL_RETURN.append(cntr)


#Setting up homebound path of stilts condition in scene 4
CP_ACTOR_STILTS_RETURN = []

CP_COUNT_ACTOR_STILTS_RETURN = 58
CONTROLPOINT_ACTOR_STILTS_RETURN_PREFEX = 'stilts.Rpath.'  #name of boxes = layera1 ... layera17
CONTROLPOINT_ACTOR_STILTS_RETURN_SUFFEX = ''  #use '_Cube' for .obj and '' for.osg

for cpNumber in range( 0,CP_COUNT_ACTOR_STILTS_RETURN):	
	nodename = '%s%03d%s' % (CONTROLPOINT_ACTOR_STILTS_RETURN_PREFEX, cpNumber,CONTROLPOINT_ACTOR_STILTS_RETURN_SUFFEX)
	pointNode = movementPaths.getChild(nodename)
	nodebox = pointNode.getBoundingBox()
	cntr = [nodebox.center[0],-nodebox.center[2],nodebox.center[1]]  #this is the xyz setting ONLY for .OSG file
	print 'stilts.Rpath.',cpNumber, cntr
	CP_ACTOR_STILTS_RETURN.append(cntr)
	
	
#Setting up homebound path of stumps condition in scene 4
CP_ACTOR_STUMPS_RETURN = []

CP_COUNT_ACTOR_STUMPS_RETURN = 54
CONTROLPOINT_ACTOR_STUMPS_RETURN_PREFEX = 'stumps.Rpath.'  #name of boxes = layera1 ... layera17
CONTROLPOINT_ACTOR_STUMPS_RETURN_SUFFEX = ''  #use '_Cube' for .obj and '' for.osg

for cpNumber in range( 0,CP_COUNT_ACTOR_STUMPS_RETURN):	
	nodename = '%s%03d%s' % (CONTROLPOINT_ACTOR_STUMPS_RETURN_PREFEX, cpNumber,CONTROLPOINT_ACTOR_STUMPS_RETURN_SUFFEX)
	pointNode = movementPaths.getChild(nodename)
	nodebox = pointNode.getBoundingBox()
	cntr = [nodebox.center[0],-nodebox.center[2],nodebox.center[1]]  #this is the xyz setting ONLY for .OSG file
	print 'stumps.Rpath.',cpNumber, cntr
	CP_ACTOR_STUMPS_RETURN.append(cntr)

#Actors Activation####################################
def actorsScene4Enable():
	ant7.enable(viz.RENDERING)
	ant8.enable(viz.RENDERING)
	ant9.enable(viz.RENDERING)
	
def controlAction():
	for each in CP_ACTOR_CONTROL:
		print "ant7.addAction(vizact.walkto(",each,"))"
		ant7.addAction(vizact.walkto(each[0], each[1], each[2], 0.22, 720, 1))

def stiltsAction():
	for each in CP_ACTOR_STILTS:
		print "ant8.addAction(vizact.walkto(",each,"))"
		ant8.addAction(vizact.walkto(each[0], each[1], each[2], 0.226, 720, 1))

def stumpsAction():
	for each in CP_ACTOR_STUMPS:
		print "ant9.addAction(vizact.walkto(",each,"))"
		ant9.addAction(vizact.walkto(each[0], each[1], each[2], 0.225, 720, 1))

def controlReturn():
	for each in CP_ACTOR_CONTROL_RETURN:
		print "ant7.addAction(vizact.walkto(",each,"))"
		ant7.addAction(vizact.walkto(each[0], each[1], each[2], 0.22, 720, 1))

def stiltsReturn():
	count = 0
	for each in CP_ACTOR_STILTS_RETURN:
		count = count + 1
		if count < 53:
			print "ant8.addAction(vizact.walkto(",each,"))"
			ant8.addAction(vizact.walkto(each[0], each[1], each[2], 0.226, 720, 1))
		
		else:
			print "ant8.addAction(vizact.walkto(",each,"))"
			ant8.addAction(vizact.walkto(each[0], each[1], each[2], 0.10, 900, 1))

def stumpsReturn():
	count = 0
	for each in CP_ACTOR_STUMPS_RETURN:
		count = count + 1
		if count < 44:
			print "ant9.addAction(vizact.walkto(",each,"))"
			ant9.addAction(vizact.walkto(each[0], each[1], each[2], 0.224, 720, 1))
		
		else:
			print "ant9.addAction(vizact.walkto(",each,"))"
			ant9.addAction(vizact.walkto(each[0], each[1], each[2], 0.10, 900, 1))


def pickupAnts():
	ant7.addAction(vizact.move(0, 0.067,0,3))
	ant8.addAction(vizact.move(0, 0.067,0,3))
	ant9.addAction(vizact.move(0, 0.067,0,3))

def dropAnts():
	ant7.addAction(vizact.move(0,-0.067,0,3))
	ant8.addAction(vizact.move(0,-0.067,0,3))
	ant9.addAction(vizact.move(0,-0.067,0,3))


def actorsScene4Disable():
	ant7.enable(viz.RENDERING)
	ant8.enable(viz.RENDERING)
	ant9.enable(viz.RENDERING)
During action, ant 7,8 don't go to the final box, but ant 9 hit the final destination. During return sequence, ant 7, 8, 9 don't go to the final destination.

Any ideas, or insight would be appreciated. Thank you.

Kind Regards,
Iwan
Reply With Quote
  #9  
Old 05-05-2008, 06:43 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I ran your script but nothing is happening. Your script loads the path points from a file called 'antMovementPoints.osg', which was not included. Can you post this file, or modify your script so that it does not depend on it?
Reply With Quote
  #10  
Old 05-07-2008, 06:40 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Additional file...

Please find additional file posted... I do apologise for not attaching this file earlier.

Kind Regards,
Iwan
Attached Files
File Type: zip antMovementPoints.zip (69.1 KB, 910 views)
Reply With Quote
  #11  
Old 05-08-2008, 03:23 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Your sample script still does not do anything. Can you post a fully working script that I can immediately run and witness the problem. For example, there is no viz.go() statement in your script. Even when I added the viz.go() the ducks never start any actions and I don't see any key commands to initiate them.
Reply With Quote
  #12  
Old 05-10-2008, 08:13 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Red face Solved~!

Hi,

I do apologise for making you running around in a circle. I did not explain the script fully. I tried to post the full code, but this forum refused it, being too lengthy. What I posted previously was a module of a bigger simulation program. You need to add viz.go() as well at the end of the program.

I do apologise.... T_T

You may use these following these commands (in the terminal window) to make them run...

controlAction()
stiltsAction(), and
stumpsAction()

..to make them run.

I just found the solution. I increased the spacing between the movement points and it works just fine. Apparently, my spacing between points were too small. I Increased the spacing and it works really well.

Thank you.

Kind Regards,
Iwan
Reply With Quote
  #13  
Old 05-25-2008, 10:19 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Red face

Hi,

The current walkTo always restart the animation whenever a walkTo point is reached. Therefore, it gives impression of a jagged movement with lot of walkTo points in the scene.

Is there a way to use walkTo without having re-starting the animation at a new point? i.e. Getting a an avatar to run along given points without walkTo reset animation at every points.

Thank you kindly.
Reply With Quote
  #14  
Old 05-27-2008, 11:49 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You can manually set the animation of the avatar and use vizact.goto instead of vizact.walkto. Once the final destination has been reached you can clear the animation manually.
Reply With Quote
  #15  
Old 06-09-2008, 10:53 PM
k_iwan k_iwan is offline
Member
 
Join Date: May 2006
Posts: 115
Hi,

Yes, goto works fine. But it doesn't rotate the direction of the avatar automatically. I better stick with walkto.
Thank you for your replies

Kind Regards,
iwan
Reply With Quote
  #16  
Old 06-10-2008, 10:04 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The next release of Vizard will allow specifying None as the walk animation, which will not affect the animation state.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Animation Tracks.... k_iwan Vizard 2 03-26-2007 05:52 PM
Jumpy animation Elizabeth S Vizard 1 11-08-2006 02:11 PM
animation sequence pkhoosh Vizard 2 01-23-2006 08:03 AM
avatar animation problems jrodman Vizard 1 01-18-2006 09:12 AM
Making an avatar speak while performing an idling animation vr_boyko Vizard 1 10-05-2004 04:23 PM


All times are GMT -7. The time now is 06:08 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC