Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 863 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: [Newton] Breakable Objects / Bruchstücke [Re: FBL] #298356
11/14/09 12:50
11/14/09 12:50
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline
Member
Blackchuck  Offline
Member
B

Joined: Jul 2009
Posts: 150
Hmmm.
How made that "breakeble objeckt" projeckt?
Maby he could help us alittlebit out.


I have know Gamestudio/A7 Commercial Edition 7.84
Re: [Newton] Breakable Objects / Bruchstücke [Re: Blackchuck] #298357
11/14/09 13:00
11/14/09 13:00
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline
Serious User
VeT  Offline
Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
2 Firoball:
//I've extended the mesh converter so it only reads certain mesh subsets.
Can you share this? laugh

2 Blackchuck:
Breakable objects are almost ready in Newton's code, that is written in c++.. somebody just may convert it from c++ to lite-c and work is done laugh
i'm working on character controller and car controller, in addition i dont have enough time for that... maybe, after controllers i'll go to brekeable objects.


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: [Newton] Breakable Objects / Bruchstücke [Re: VeT] #298359
11/14/09 13:04
11/14/09 13:04
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline
Serious User
VeT  Offline
Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
PS:
2 Firoball:
did you worked with NewtonSetWorldSize in newton_addstaticcollisiongeometry()?
ventilator wanted to make world size depends on size of treecollision... i'm going to add this in the next version of wrapper with the help of NewtonCollisionCalculateAABB()

2 Blackchuck:
adding Newton to project is not too hard, look at main.c.. well, also i wrote lesson in english, how to add Newton to project, but lesson is lost on the filefront(i uploaded files there before), so this evening i'l look for it on my comp.


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: [Newton] Breakable Objects / Bruchstücke [Re: VeT] #298361
11/14/09 13:14
11/14/09 13:14
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
The change is very project spedific so I don't know how much sense it makes to take this over to the wrapper.
But I will share anyway.

The rules:
- If there is only one subset, everything behaves as usual.
- If there are more than one subsets, the first one is used for collision, the remaining ones are used for display.
- The collision subset (first subset in mesh) must have at least some sort of skin (best is a skin without texture - it is never seen anyway).
- The subset order can be derived from the mesh group number in MED. It is important to make sure the collision mesh is the first group in MED
- This needs A7.8 due to the vmask instruction.

Code:
void newton_treecollisionaddentity(NewtonCollision* treecollision, ENTITY* entity)
{
	if(!entity) return;
	
	LPD3DXMESH pmesh = (LPD3DXMESH)ent_getmesh(entity, 0, 0);
	int numvertices = pmesh->GetNumVertices();
	int numfaces = pmesh->GetNumFaces();
	int meshes = ent_status(entity, 9);
	if (meshes > 1)
	{
		entity->vmask |= 0x1; //hide first mesh group, it is used for collision	
	}	
	_VERTEX_ *pvertices; pmesh->LockVertexBuffer(0, (void**)&pvertices);
	short *pindices; pmesh->LockIndexBuffer(0, (void**)&pindices);
	int *pattributes; pmesh->LockAttributeBuffer(0, &pattributes);
	
	// transform vertices to world space
	D3DXVECTOR4 *ptransformedvertices = (D3DXVECTOR4*)malloc(sizeof(D3DXVECTOR4) * numvertices);
	D3DXMATRIX m; ent_getmatrix(entity, &m);
	D3DXVECTOR3 tempvector;
	int i;
	for(i = 0; i < numvertices; i++)
	{
		tempvector.x = pvertices[i].x;
		tempvector.y = pvertices[i].z; // direct3d -> 3dgs coordinate system
		tempvector.z = pvertices[i].y; // direct3d -> 3dgs coordinate system 
		D3DXVec3Transform(&ptransformedvertices[i], &tempvector, &m);	
	}
	
	// add triangles to collision tree
	for(i = 0; i < numfaces; i++)
	{	
		float v[9];
		// use first mesh if only one mesh is available, otherwise use all meshes except first
		if ((meshes > 1 && pattributes[i] == 0) || meshes == 1)
		{
			v[0] = ptransformedvertices[pindices[(i*3)+2]].x * QUANTTOMETER;
			v[1] = ptransformedvertices[pindices[(i*3)+2]].y * QUANTTOMETER;
			v[2] = ptransformedvertices[pindices[(i*3)+2]].z * QUANTTOMETER;
			v[3] = ptransformedvertices[pindices[(i*3)+1]].x * QUANTTOMETER;
			v[4] = ptransformedvertices[pindices[(i*3)+1]].y * QUANTTOMETER;
			v[5] = ptransformedvertices[pindices[(i*3)+1]].z * QUANTTOMETER;
			v[6] = ptransformedvertices[pindices[(i*3)+0]].x * QUANTTOMETER;
			v[7] = ptransformedvertices[pindices[(i*3)+0]].y * QUANTTOMETER;
			v[8] = ptransformedvertices[pindices[(i*3)+0]].z * QUANTTOMETER;
			NewtonTreeCollisionAddFace(treecollision, 3, v, 12, pattributes[i]);
		}
	}
	
	free(ptransformedvertices);
	
	pmesh->UnlockVertexBuffer();
	pmesh->UnlockIndexBuffer();
	pmesh->UnlockAttributeBuffer();
}



Re: [Newton] Breakable Objects / Bruchstücke [Re: FBL] #298552
11/15/09 23:10
11/15/09 23:10
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline
Serious User
VeT  Offline
Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
Thanks, i'll look into it... Also, i finished with NewtonSetWorldSize(), you may find it at the next update.


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: [Newton] Breakable Objects / Bruchstücke [Re: VeT] #298781
11/17/09 19:27
11/17/09 19:27
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline
Member
Blackchuck  Offline
Member
B

Joined: Jul 2009
Posts: 150
VeT the newton Character controlles hears very interesting to.
Is it writen like helf lite-c and half newton or did you just use newton?
when yes, can it be that you animated with boens?


I have know Gamestudio/A7 Commercial Edition 7.84
Re: [Newton] Breakable Objects / Bruchstücke [Re: Blackchuck] #298792
11/18/09 01:10
11/18/09 01:10
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline
Serious User
VeT  Offline
Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
Half lite-c anf half Newton... Its interesting, but its also hard enough: i re-write code of controller in the 5-th time from the very begining, spend a lot of weeks of work, and still no results frown
Controller is exist, capsule dont fall down, but i cant correctly move it.


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: [Newton] Breakable Objects / Bruchstücke [Re: VeT] #298850
11/18/09 12:40
11/18/09 12:40
Joined: Jul 2009
Posts: 150
B
Blackchuck Offline
Member
Blackchuck  Offline
Member
B

Joined: Jul 2009
Posts: 150
OK, now I knopw what you meen I tested it by myself like this;

var ISOMETRIC;

action free_camera()
{
c_setminmax(my);
VECTOR camera_force;
set(my,INVISIBLE|POLYGON);
camera_force.z = 0;
vec_set(camera.x,my.x);
vec_set(camera.pan,my.pan);
while(1)
{
camera_force.x = (key_w - key_s)*10*time_step;
camera_force.y = (key_a - key_d)*10*time_step; vec_add(my.pan,vector(mouse_force.x(-7)*time_step,mouse_force.y*7*time_step,0));
c_move(my,camera_force,nullvector,GLIDE+IGNORE_PASSABLE+IGNORE_PASSENTS+IGNORE_PUSH);
vec_set(camera.x,vector(my.x,my.y,my.z+15));
vec_set(camera.pan,my.pan);
wait(1);
}
}

That has no reaktion to the newton objeckts.
So I tryed like this;

var ISOMETRIC;

action free_camera()
{
c_setminmax(my);
VECTOR camera_force;
set(my,INVISIBLE|POLYGON);
camera_force.z = 0;
vec_set(camera.x,my.x);
vec_set(camera.pan,my.pan);
wait(3);
newton_addentity(me, (float)5, NEWTON_BOX, onforceandtorque);
while(1)
{
camera_force.x = (key_w - key_s)*10*time_step;
camera_force.y = (key_a - key_d)*10*time_step;
vec_add(my.pan,vector(mouse_force.x*(-7)*time_step,mouse_force.y*7*time_step,0));
c_move(my,camera_force,nullvector,GLIDE+IGNORE_PASSABLE+IGNORE_PASSENTS+IGNORE_PUSH);
vec_set(camera.x,vector(my.x,my.y,my.z+15));
vec_set(camera.pan,my.pan);

wait(1);
}
}

But that falles just throw everithing.
But it lookes cool becuse of tha camera laugh


I have know Gamestudio/A7 Commercial Edition 7.84
Re: [Newton] Breakable Objects / Bruchstücke [Re: Blackchuck] #298886
11/18/09 18:35
11/18/09 18:35
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline
Serious User
VeT  Offline
Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
First, you mix Newton and standard c_ functions... If you create Newton body with newton_addentity(), then c_move wouldnt work at all.
Second, you may apply all forces to bofu incide onforceandtorque function.


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Page 2 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1