WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-01-2011, 02:14 AM
hachilab hachilab is offline
Member
 
Join Date: Jun 2011
Posts: 3
Problem with <node3d>.center

Hello everyone,

I have a problem with the command <node3d>.center which sets the origin of an object.

object.center(x,y,z)
The setting of y value doesn't work.

Only x and z is ok...

Do you have the same problem?
Reply With Quote
  #2  
Old 07-01-2011, 12:20 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,458
Can you post some example code that shows your problem?

In the following example the center of the ball on the left is changed in the y value which affects it's rotation:
Code:
import viz
import vizact
viz.go()

ball = viz.addChild('ball.wrl',pos=[-0.5,1.5,4])
ball.center(0,0.25,0)

ball2 = ball.copy(pos=[0.5,1.5,4])

spin = vizact.spin(1,0,0,90)
ball.addAction(spin)
ball2.addAction(spin)
Reply With Quote
  #3  
Old 07-03-2011, 11:39 PM
hachilab hachilab is offline
Member
 
Join Date: Jun 2011
Posts: 3
Thank you Jeff.

It works for 'spin'.
Infact, I was tring to change the position of an object/avatar.

import viz
import vizact
viz.go()

ground = viz.add('roughground.wrl')
ball = viz.add('ball.wrl')
ball.center(0,1,0)
move = vizact.walkTo([1,ground,1], walkAnim = None, walkSpeed = 0.5)
vizact.onkeydown('1', ball.addAction, move)

I tried to move the ball along a rough surface. However, using above lines, the ball was not "above" but "partially inside" the ground. I tried to set the level of the ball by [1,gound+1,1], but it seems an invalid command. So, I tried to set the "built-in position" by "ball.center(0,1,0)". It doesn't work. Sorry for the confusion.

Best Regards
Reply With Quote
  #4  
Old 07-05-2011, 02:49 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,458
You can use the <node3D>.setPosition command to set the ball at ground level:
Code:
import viz
import vizact
viz.go()

ground = viz.addChild('tut_ground.wrl')
ball = viz.addChild('ball.wrl')
ball.setPosition([-2,0.5,7])
move = vizact.moveTo([2,0.5,7],speed=1)
vizact.onkeydown('1', ball.addAction, move)
Reply With Quote
  #5  
Old 07-06-2011, 02:25 AM
hachilab hachilab is offline
Member
 
Join Date: Jun 2011
Posts: 3
Thanks Jeff.
In fact the ground is not a flat surface. The level changes according to different positions.
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
Vizard problem mizutani_jun Vizard 4 01-09-2011 04:39 PM
winviz.exe problem llqqff Vizard 2 07-16-2010 10:08 AM
export problem bazelaisr Vizard 2 05-28-2008 11:19 AM
problem with female animations vmonkey Vizard 1 10-07-2005 11:36 AM
sound problem alaa Vizard 7 09-02-2005 02:13 PM


All times are GMT -7. The time now is 11:43 PM.


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