<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - This Clicking Script isn't working(solved)]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=982&amp;type=atom"/>
	<updated>2014-04-28T16:03:14Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=982</id>
		<entry>
			<title type="html"><![CDATA[Re: This Clicking Script isn't working(solved)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6730#p6730"/>
			<content type="html"><![CDATA[<p>I figured out how to change the code for it to work! </p><div class="codebox"><pre><code>Unprojected = getObject(&quot;Unprojected&quot;)
clicked = false

function Click(objectName,camera)
    --[[----------------------------------------------------------------------UNPROJECTED POINT]]
    mx = getAxis(&quot;MOUSE_X&quot;)
    my = getAxis(&quot;MOUSE_Y&quot;)    

    V1 = getUnProjectedPoint(camera, vec3(mx, my, 0))
    V2 = getUnProjectedPoint(camera, vec3(mx, my, 1))

    --point, Unprojected = rayHit(V1, V2) -- note that rayHit only detects objects with physics enabled
    
    point = rayHit(V1,V2,objectName)
    
    
    if point then --if there is a collision between camera and a point (x,y,z) where x is mouse position, and y is mouse position and z is extended in front...
        Xname = getName(objectName)
        Xobj = getObject(Xname)
        --setText(text,Xname)
        --print(Xname)
        
        if Xname == getName(objectName) and onKeyDown(&quot;MOUSE_BUTTON1&quot;) then 
            --deactivate(Xobj)
            deactivate(Xobj)            
            playSound(sound) 
            clicked = true 
        --[[else 
            clicked = false --]]
        end
    end
        
end    </code></pre></div>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-04-28T16:03:14Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6730#p6730</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[This Clicking Script isn't working(solved)]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6729#p6729"/>
			<content type="html"><![CDATA[<p>I can&#039;t figure out why this code isn&#039;t working. The object does have physics enabled, and the &quot;unprojected&quot; object is in the game. </p><div class="codebox"><pre><code>Unprojected = getObject(&quot;Unprojected&quot;)
clicked = false

function Click(objectName,camera)
    --[[----------------------------------------------------------------------UNPROJECTED POINT]]
    mx = getAxis(&quot;MOUSE_X&quot;)
    my = getAxis(&quot;MOUSE_Y&quot;)    

    V1 = getUnProjectedPoint(camera, vec3(mx, my, 0))
    V2 = getUnProjectedPoint(camera, vec3(mx, my, 4))

    point, Unprojected = rayHit(V1, V2) -- note that rayHit only detects objects with physics enabled
    
    
    if point then --if there is a collision between camera and a point (x,y,z) where x is mouse position, and y is mouse position and z is extended in front...
        Xname = getName(Unprojected)
        Xobj = getObject(Xname)
        --setText(text,Xname)
        --print(Xname)
        
        if Xname == objectName and onKeyDown(&quot;MOUSE_BUTTON1&quot;) then 
            deactivate(Xobj) 
            playSound(sound) 
            clicked = true 
        --[[else 
            clicked = false --]]
        end
    end
        
end    

function onSceneUpdate()
    Click(&quot;monkey&quot;,mainCamera)
end</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-04-28T15:43:54Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6729#p6729</id>
		</entry>
</feed>
