WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 03-20-2017, 02:04 AM
Ultim Ultim is offline
Join Date: Mar 2017
Posts: 1
Point of an intersecting line and plane


I am trying to work with moving objects using the mouse.
for doing this I want to calculate the position of the mouse on XY plane.
When the XY coordinates are known i want to move the ball to those XY coordinates.
I have a ball in my world which will be the object of moving.

here is the code so far:
plane = vizshape.addPlane()
mouseposition = Camera.main.ScreenPointToRay(Input.mousePosition);

I tried to use viz.intersect but got a lot of errors.
do you guys have any advice.

With kind regards.
Reply With Quote
Old 03-20-2017, 02:46 AM
Jeff Jeff is offline
WorldViz Team Member
Join Date: Aug 2008
Posts: 2,467
You could use the viz.pick command to get the point of intersection between the mouse and the object it is pointing at. Here's an example:

import viz
import vizact
import vizshape


dojo = viz.add('dojo.osgb')
sphere = vizshape.addSphere(radius=0.1,color=viz.GREEN)

def moveSphere():
	info = viz.pick(info=True)
	point = info.point
Reply With Quote

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
Find collision point of line and arbitrary object asdf Vizard 2 01-28-2013 10:04 AM

All times are GMT -7. The time now is 09:48 AM.

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