<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Maratis forum - This Clicking Script isn't working(solved)]]></title>
		<link>http://forum.maratis3d.com/viewtopic.php?id=982</link>
		<description><![CDATA[The most recent posts in This Clicking Script isn't working(solved).]]></description>
		<lastBuildDate>Mon, 28 Apr 2014 16:03:14 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: This Clicking Script isn't working(solved)]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=6730#p6730</link>
			<description><![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>]]></description>
			<author><![CDATA[dummy@example.com (Tutorial Doctor)]]></author>
			<pubDate>Mon, 28 Apr 2014 16:03:14 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=6730#p6730</guid>
		</item>
		<item>
			<title><![CDATA[This Clicking Script isn't working(solved)]]></title>
			<link>http://forum.maratis3d.com/viewtopic.php?pid=6729#p6729</link>
			<description><![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>]]></description>
			<author><![CDATA[dummy@example.com (Tutorial Doctor)]]></author>
			<pubDate>Mon, 28 Apr 2014 15:43:54 +0000</pubDate>
			<guid>http://forum.maratis3d.com/viewtopic.php?pid=6729#p6729</guid>
		</item>
	</channel>
</rss>
