Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/vrmedia2/public_html/forums/Sources/Load.php(225) : runtime-created function on line 3
Cubetti
forums.vrmedia.it
Welcome, Guest. Please login or register.
April 29, 2017, 12:28:05 PM

Login with username, password and session length
Search:     Advanced search
SMF - Just Installed
1444 Posts in 465 Topics by 370 Members
Latest Member: landiandrea
* Home Help Search Login Register
+  forums.vrmedia.it
|-+  Programming with XVR
| |-+  Projects Discussion
| | |-+  Cubetti
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Cubetti  (Read 12394 times)
kurt
Full Member
***
Offline Offline

Posts: 47


Email
« on: March 10, 2007, 11:43:51 AM »

I found this project in many xvr pages, but there is no more a link to download the source.

It would be very useful for me to study the object manipulation.

is there anyone that may provide me Cubetti source, please?

thanks
Logged
ilmale
Global Moderator
Hero Member
*****
Offline Offline

Posts: 140


lrosario80
Email
« Reply #1 on: March 10, 2007, 03:36:31 PM »

I send you a physic enhanced version of "Cubetti", it's designed to work with a Grabber ->http://www.percro.org/index.php?pageId=GRAB and have some problem with mouse.

Install: Unpack the cubbetti.zip file in a folder, then copy "suoni.zip" (next post) in the same folder.
Logged

~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~
ilmale
Global Moderator
Hero Member
*****
Offline Offline

Posts: 140


lrosario80
Email
« Reply #2 on: March 10, 2007, 03:37:42 PM »

Second post to attach the file "Suoni.zip", this forum have a limit on attachment dimension
Logged

~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~
kurt
Full Member
***
Offline Offline

Posts: 47


Email
« Reply #3 on: March 11, 2007, 12:38:10 PM »

thank you!!
Logged
kurt
Full Member
***
Offline Offline

Posts: 47


Email
« Reply #4 on: March 19, 2007, 09:02:41 AM »

Hi! I tried to run the code of cubetti which you linked but it doesn't.

it returns this fatal error:

Init Data...

Code:
Loading PhysXVR library....

VirtualMachine ERROR (line 25): Fatal error. Please contact: support@vrmedia.it

Call stack:
------------------
Called from: LOADLIB(25)
Called from: CVMPHMANAGER::CVMPHMANAGER(78)
------------------
VRPlayer Stopped!

Any suggestion to fix it?

thanks
Logged
ilmale
Global Moderator
Hero Member
*****
Offline Offline

Posts: 140


lrosario80
Email
« Reply #5 on: March 22, 2007, 08:38:09 AM »

Sorry, I almost forgot that the physics engine included in the demo is the PhysX Ageia..  Roll Eyes
You need to install the ageia physX library in order to let is works.
You can find Ageia system software here -> http://www.ageia.com/drivers/drivers.html
Logged

~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~
kurt
Full Member
***
Offline Offline

Posts: 47


Email
« Reply #6 on: March 27, 2007, 12:23:43 PM »

Thanks, now it works, but it has got a too much sophysticated physics for this kind of project and for my needs.  Undecided

Do you have the original Cubetti project? I need to know how the grab control was managed.  Huh
« Last Edit: March 28, 2007, 04:40:26 PM by kurt » Logged
ilmale
Global Moderator
Hero Member
*****
Offline Offline

Posts: 140


lrosario80
Email
« Reply #7 on: March 31, 2007, 07:52:54 PM »

I don't have the original code, but It was something like that Smiley
Code:
/*!
 * Selects a graphical object when the middle mouse button is pressed.
 */
function CVmPhManager::SelectByMouse()
{
var viewport = glget(GL_VIEWPORT);

var winx = Mouse.X; //x*1.0f/width;
var winy = viewport[3] - 1 - Mouse.Y; //1.0f - y*1.0f/height;

var vec0 = [winx, winy,0.0];
var vec1 = [winx, winy,1.0];

var p0 = gluUnProject(vec0);
var p1 = gluUnProject(vec1);
return SelectByPoints(p0, p1, Mouse.ButtonM);
}

function CVmPhManager::SelectByPoints(p0, p1, button)
{   
static var selected=false;
static var distance=0;
static var offset;
static var selectObj = -1;


if(button && !selected){
var compID;
var minDist = SCENE_FAR;
var dist = array(3);
var pInt = [0.0,0.0,0.0];
var nrml = [0.0,0.0,0.0];
var n_tr;
// Compute the nearest object from p0 to p1
for(var i = 0; i < len(Obj); i++){
if(Obj[i].obj.IsColliding(p0, p1, &pInt, &nrml, &n_tr, &compID)){
dist = modulus(pInt - p0);
if(minDist > dist){
selectObj = Obj[i];
minDist = dist;
selected = true;
offset = Obj[i].GetPosition() - pInt;
}
}
distance = minDist;
}
if(selected){
var newPosition = p0+norm(p1-p0)*distance + offset;
selectObj.SetPosition(newPosition);
}
if(!button)
selected = false;

return selectObj;
}
Obj is an array of physics objects, but if you don't use the physic you can use an array of the graphical objects that you want to grab.
In the original code the Z movement was set to zero, cause the game work in a plane.
Remember the isColliding function work with ZBuffer, so this code will work only after the objects has been drawed.
Logged

~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!