Jump to content
Sign in to follow this  
Miroslaw Kowalski

PhysX Problem with ship

Recommended Posts

Hey Guys,

I'm trying to convert my ship which was running with "simulation = "ship"" to "simulation = "shipx"". So I made a Geometry Phys LOD in the new version of Oxygen 2 and changed "ship" to "shipx" but after importing this (http://www.youtube.com/watch?v=1LVIpI2zi2g&feature=youtu.be) happens and i can't move...Also the icon of the ship isn't appearing anymore.

Here is the config:

#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7
#define true 1
#define false 0
#define private 0
#define protected 1
#define public 2


class CfgPatches 
{
class Ares_Patrolboat_F
{
	units[] = {"patrolboat"};
	weapons[] = {};
	requiredVersion = 0.1;
	requiredAddons[] = {"A3_Boat_F_Boat_Armed_01"};
};
};

class DefaultEventhandlers;
class RCWSOptics;
class Turrets;
class Newturret;

class CfgVehicles
{
class Ship;

class patrolboat : Ship
{
	mapsize = 75;

	displayName = "Ares Patrolboat";
	vehicleClass = "ship";

	driverCanSee = 31;
	commanderCanSee = 31;
	gunnerCanSee = 31;
	radarType = 7;
	LockDetectionSystem = 8 + 4;
	IncomingMissileDetectionSystem = 16;

	irScanRangeMin = 500;
	irScanRangeMax = 200000;
	irScanToEyeFactor = 18;

	scope = 2;

	crew = "B_soldier_F";
	faction = ares;
	side = TWest;
	typicalCargo[] = {"B_Soldier_F", "B_Soldier_F"};

	class TransportItems
	{
		class _xx_FirstAidKit
		{
			name = "FirstAidKit";
			count = 10;
		};

		class _xx_medikit
		{
			name = "medikit";
			count = 1;
		};
	};

	armor = 2000;
	armorStructural = 40.0;

	accuracy = 0.5;
	model = "\patrolboat\patrolboat.p3d";
	Icon = "\patrolboat\data\UI\map_patrolboat.paa";
	unitInfoType = "UnitInfoShip";
	insideSoundCoef = 0;
	soundEngineOnInt[] = {"a3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-ext-start-02", 1.0, 1.0};
	soundEngineOnExt[] = {"a3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-ext-start-02", 1.0, 1.0, 200};
	soundEngineOffInt[] = {"a3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-ext-stop-02", 1.0, 1.0};
	soundEngineOffExt[] = {"a3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-ext-stop-02", 1.0, 1.0, 200};

	class Sounds
	{
		class IdleOut
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-idle-2", db5, 1.0, 300};
			frequency = "0.95	+	((rpm/	1200) factor[(100/	1200),(300/	1200)])*0.15";
			volume = "engineOn*(((rpm/	1200) factor[(0/	1200),(30/	1200)])	*	((rpm/	1200) factor[(500/	1200),(300/	1200)]))";
		};

		class Engine
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-low-2", db10, 1.0, 450};
			frequency = "0.95	+	((rpm/	1200) factor[(300/	1200),(600/	1200)])*0.2";
			volume = "engineOn*(((rpm/	1200) factor[(150/	1200),(250/	1200)])	*	((rpm/	1200) factor[(600/	1200),(400/	1200)]))";
		};

		class EngineMidOut
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-mid-2", db10, 1.0, 500};
			frequency = "0.95	+		((rpm/	1200) factor[(600/	1200),(900/	1200)])*0.2";
			volume = "engineOn*(((rpm/	1200) factor[(350/	1200),(500/	1200)])	*	((rpm/	1200) factor[(1000/	1200),(700/	1200)]))";
		};

		class EngineMaxOut
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-high-2", 5.62341, 1.0, 600};
			frequency = "0.95	+	((rpm/	1200) factor[(700/	1200),(1000/	1200)])*0.2";
			volume = "engineOn*((rpm/	1200) factor[(800/	1200),(1200/	1200)])";
		};

		class WaternoiseOutW0
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\SFX\voda-o-bok-lodi-0-speed1", db-10, 1.0, 250};
			frequency = "1";
			volume = "(speed factor[4, 1])";
		};

		class WaternoiseOutW1
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\SFX\voda-o-bok-lodi-20-speed", db-10, 1.0, 250};
			frequency = "1";
			volume = "((speed factor[2, 6]) min (speed factor[6, 4]))";
		};

		class WaternoiseOutW2
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\SFX\voda-o-bok-lodi-50-speed", db-10, 1.0, 250};
			frequency = "1";
			volume = "(speed factor[3, 9])";
		};
	};

	class HitPoints
	{
		class HitBody
		{
			armor = 0.7;
			material = 50;
			name = "karoserie";
			visual = "zbytek";
			passThrough = true;
		};

		class HitEngine
		{
			armor = 0.12;
			material = -1;
			name = "Engine";
			visual = "";
			passThrough = true;
		};

		class HitTurret
		{
			armor = 0.7;
			material = -1;
			name = "otochlaven";
			visual = "otochlaven";
			passThrough = true;
		};
	};

	hasDriver=true;
	hasGunner=false;
	hasCommander=false;
	driverLeftHandAnimName = "drivewheel";
	driverRightHandAnimName = "drivewheel";
	driverAction = "driver_boat01";
	getInAction = "GetInMedium";
	getOutAction = "GetOutMedium";
	cargoAction[] = {"passenger_generic01_foldhands", "passenger_generic01_leanleft", "passenger_generic01_leanright", "passenger_generic01_foldhands", "passenger_generic01_leanleft", "passenger_generic01_leanright", "passenger_generic01_foldhands", "passenger_generic01_leanleft", "passenger_generic01_leanright", "passenger_generic01_foldhands", "passenger_generic01_leanleft", "passenger_generic01_leanright"};
	cargoGetInAction[] = {"GetInMedium"};
	cargoGetOutAction[] = {"GetOutMedium"};
	castDriverShadow = true;
	castCargoShadow = true;
	driverhasflares = true;
	gunnerHasFlares = false;
	gunneriscommander= true;
	enableGPS = 1;
	transportSoldier = 12;
	cost = 10000;

	supplyRadius = 3;
	precision = 15;
	steerAheadSimul = 0.5;
	steerAheadPlan = 0.35;
	predictTurnPlan = 0.8;
	predictTurnSimul = 0.6;
	brakeDistance = 60.0;	// vehicle movement precision
	acceleration = 15;
	turnCoef = 0.45;
	maxSpeed = 60;	// max speed on level road, km/h
	simulation = "shipx";
	thrustDelay = 2;
	overSpeedBrakeCoef = 0.2;
	enginePower = 66200;
	engineShiftY = -10.100;
	waterLeakiness = 200;
	waterLinearDampingCoefY = 10;
	waterLinearDampingCoefX = 2.0;
	waterAngularDampingCoef = 30;
	waterResistanceCoef = 0.0015;
	rudderForceCoef = 14;
	rudderForceCoefAtMaxSpeed = 18;
	idleRpm = 200;
	redRpm = 1200;

	class complexGearbox
	{
		GearboxRatios[] = {"R1", -0.782, "N", 0, "D1", 2};
		TransmissionRatios[] = {"High", 1.0};
		gearBoxMode = "auto";
		moveOffGear = 1;
		driveString = "D";
		neutralString = "N";
		reverseString = "R";
	};

	enableManualFire = 0;
	smokeLauncherGrenadeCount = 20;
	smokeLauncherVelocity = 14;
	smokeLauncherOnTurret = 0;
	smokeLauncherAngle = 180;
	magazines[] = {"60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine"};
	weapons[] = {"CMFlareLauncher"};

	/*class Exhausts
	{
		class Exhaust1
		{
			position = "Exhaust1";
			direction = "Exhaust1_dir";
			effect = "DamageSmokePlane";
		};
	};*/

	memoryPointsLeftWaterEffect = "waterEffectL";
	memoryPointsRightWaterEffect = "waterEffectR";
	leftFastWaterEffect = "LFastWaterEffects";
	rightFastWaterEffect = "RFastWaterEffects";
	waterEffectSpeed = 5;
	engineEffectSpeed = 5;
	waterFastEffectSpeed = 18;

	class Turrets : Turrets
	{

	};

	extCameraPosition[] = {0, 30, -70.0};

	class Reflectors
	{
		class Left
		{
			color[] = {1.0, 1.0, 1.0, 1.0};
			ambient[] = {0.2, 0.2, 0.2, 1.0};
			position = "light_left";
			direction = "light_left_dir";
			hitpoint = "light_left";
			selection = "light_left";
			size = 0.5;
			brightness = 0.6;
		};
	};

	aggregateReflectors[] = {{"Left"}};

	//hiddenSelections[] = {"Camo", "Camo2", "Camo3"};
};
};

Thanks for your help :)

PS: If you need the model and the other things: http://www.file-upload.net/download-8317223/patrolboat.rar.html

Share this post


Link to post
Share on other sites

Thank you for showing me this thread :) Now I got it working like this: http://www.youtube.com/watch?v=7RnIFPtcVsQ&feature=youtu.be&hd=1 So the ship is sinking but I can accelerate in the water...but as soon as I accelerate it flips over and my character drowns. What am I doing wrong?

Here are my project files if you need them: http://www.file-upload.net/download-8323542/patrolboat.rar.html

Thanks for your help

Share this post


Link to post
Share on other sites

Give me some time.

Okay tried around a bit. I think it's an weight issue. Also, your enginePower is way to high.

At the moment your boat has 90000hp.....

Edited by RedPhoenix

Share this post


Link to post
Share on other sites

First thing to fix is : all geometries are inverted and not convex , so your ship has really no Geometry

Share this post


Link to post
Share on other sites

How can I make the geometries convex?

Edit: Which LODs need to be convex? Now I have Geometry, Geometry Phys and Geometry Buoyancy convex...

Edited by BusterBlader

Share this post


Link to post
Share on other sites

All viewgeo firegeo geo and physx Geometry lod need to be convex and components found , physx gemoetry also need to be very simple in ships i imagine just the Hull one simple shpe and component but could be 3 or 4 if very necessay

Share this post


Link to post
Share on other sites
Okay thank you...can I somehow make things convex in Oxygen 2 because the function in Blender doesn't work...

make a shape that is very simple and fits outline of your need and then structure > convexity > somponent convex hull

wehn happy try structure > convexity > find nonconvexities , if it finds some then fix

Share this post


Link to post
Share on other sites

Hello,

It's not working...maybe I am doing something wrong but I am getting really frustrated :D

If you have some time please take a look at my project files (model or config) and tell me what is wrong with them.

Project files:

http://www.file-upload.net/download-8332202/patrolboat.rar.html

Thank you very much

Share this post


Link to post
Share on other sites

Well, looking the model I found that into the Geometry lod you haven't set any mass for it http://prntscr.com/26oewq

Place a number at the left lower corner (this number will be the total mass of your ship).

Share this post


Link to post
Share on other sites

Awesome! Now it's floating on the watervery nicely :D But it doesn't sink as much in the water as it should do and it isn't moving anymore...

Share this post


Link to post
Share on other sites

Weird. Checked for everything I could (config wise) but didn't found an error.

#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7
#define true 1
#define false 0
#define private 0
#define protected 1
#define public 2


class CfgPatches 
{
class Ares_Patrolboat_F
{
	units[] = {"patrolboat"};
	weapons[] = {};
	requiredVersion = 0.1;
	requiredAddons[] = {};
};
};

class DefaultEventhandlers;
class RCWSOptics;
class Turrets;
class Newturret;

class CfgVehicles
{
class Ship;

class patrolboat : Ship
{
	mapsize = 75;

	displayName = "Ares Patrolboat";
	vehicleClass = "ship";

	driverCanSee = 31;
	commanderCanSee = 31;
	gunnerCanSee = 31;
	radarType = 7;
	LockDetectionSystem = 8 + 4;
	IncomingMissileDetectionSystem = 16;

	irScanRangeMin = 500;
	irScanRangeMax = 200000;
	irScanToEyeFactor = 18;

	scope = 2;

	crew = "B_soldier_F";
	faction = ares;
	side = TWest;
	typicalCargo[] = {"B_Soldier_F", "B_Soldier_F"};

	class TransportItems
	{
		class _xx_FirstAidKit
		{
			name = "FirstAidKit";
			count = 10;
		};

		class _xx_medikit
		{
			name = "medikit";
			count = 1;
		};
	};

	armor = 2000;
	armorStructural = 40.0;

	accuracy = 0.5;
	model = "\patrolboat\patrolboat.p3d";
	Icon = "\patrolboat\data\UI\map_patrolboat.paa";
	unitInfoType = "UnitInfoShip";
	insideSoundCoef = 0;
	soundEngineOnInt[] = {"a3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-ext-start-02", 1.0, 1.0};
	soundEngineOnExt[] = {"a3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-ext-start-02", 1.0, 1.0, 200};
	soundEngineOffInt[] = {"a3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-ext-stop-02", 1.0, 1.0};
	soundEngineOffExt[] = {"a3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-ext-stop-02", 1.0, 1.0, 200};

	class Sounds
	{
		class IdleOut
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-idle-2", db5, 1.0, 300};
			frequency = "0.95	+	((rpm/	1200) factor[(100/	1200),(300/	1200)])*0.15";
			volume = "engineOn*(((rpm/	1200) factor[(0/	1200),(30/	1200)])	*	((rpm/	1200) factor[(500/	1200),(300/	1200)]))";
		};

		class Engine
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-low-2", db10, 1.0, 450};
			frequency = "0.95	+	((rpm/	1200) factor[(300/	1200),(600/	1200)])*0.2";
			volume = "engineOn*(((rpm/	1200) factor[(150/	1200),(250/	1200)])	*	((rpm/	1200) factor[(600/	1200),(400/	1200)]))";
		};

		class EngineMidOut
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-mid-2", db10, 1.0, 500};
			frequency = "0.95	+		((rpm/	1200) factor[(600/	1200),(900/	1200)])*0.2";
			volume = "engineOn*(((rpm/	1200) factor[(350/	1200),(500/	1200)])	*	((rpm/	1200) factor[(1000/	1200),(700/	1200)]))";
		};

		class EngineMaxOut
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\Boat_Armed_01\Boat_Armed_01-high-2", 5.62341, 1.0, 600};
			frequency = "0.95	+	((rpm/	1200) factor[(700/	1200),(1000/	1200)])*0.2";
			volume = "engineOn*((rpm/	1200) factor[(800/	1200),(1200/	1200)])";
		};

		class WaternoiseOutW0
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\SFX\voda-o-bok-lodi-0-speed1", db-10, 1.0, 250};
			frequency = "1";
			volume = "(speed factor[4, 1])";
		};

		class WaternoiseOutW1
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\SFX\voda-o-bok-lodi-20-speed", db-10, 1.0, 250};
			frequency = "1";
			volume = "((speed factor[2, 6]) min (speed factor[6, 4]))";
		};

		class WaternoiseOutW2
		{
			sound[] = {"A3\Sounds_F\vehicles\boat\SFX\voda-o-bok-lodi-50-speed", db-10, 1.0, 250};
			frequency = "1";
			volume = "(speed factor[3, 9])";
		};
	};

	class HitPoints
	{
		class HitBody
		{
			armor = 0.7;
			material = 50;
			name = "karoserie";
			visual = "zbytek";
			passThrough = true;
		};

		class HitEngine
		{
			armor = 0.12;
			material = -1;
			name = "Engine";
			visual = "";
			passThrough = true;
		};

		class HitTurret
		{
			armor = 0.7;
			material = -1;
			name = "otochlaven";
			visual = "otochlaven";
			passThrough = true;
		};
	};

	hasDriver=true;
	hasGunner=false;
	hasCommander=false;
	driverLeftHandAnimName = "drivewheel";
	driverRightHandAnimName = "drivewheel";
	driverAction = "driver_boat01";
	getInAction = "GetInMedium";
	getOutAction = "GetOutMedium";
	cargoAction[] = {"passenger_generic01_foldhands", "passenger_generic01_leanleft", "passenger_generic01_leanright", "passenger_generic01_foldhands", "passenger_generic01_leanleft", "passenger_generic01_leanright", "passenger_generic01_foldhands", "passenger_generic01_leanleft", "passenger_generic01_leanright", "passenger_generic01_foldhands", "passenger_generic01_leanleft", "passenger_generic01_leanright"};
	cargoGetInAction[] = {"GetInMedium"};
	cargoGetOutAction[] = {"GetOutMedium"};
	castDriverShadow = true;
	castCargoShadow = true;
	driverhasflares = true;
	gunnerHasFlares = false;
	gunneriscommander= true;
	enableGPS = 1;
	transportSoldier = 12;
	cost = 10000;

	supplyRadius = 3;
	precision = 15;
	steerAheadSimul = 0.5;
	steerAheadPlan = 0.35;
	predictTurnPlan = 0.8;
	predictTurnSimul = 0.6;
	brakeDistance = 60.0;	// vehicle movement precision
	acceleration = 15;



	//----- General Parameters -----//		
	simulation = "shipx";
	maxSpeed = 60;	// max speed on level road, km/h
	waterLeakiness = 20;
	fuelCapacity = 800;
	fuelConsumptionRate = 45;	
	overSpeedBrakeCoef = 0.2;


	//----- Rudder Parameters -----//
	turnCoef = 0.45;
	waterLinearDampingCoefY = 10;
	waterLinearDampingCoefX = 2.0;
	waterAngularDampingCoef = 30;
	waterResistanceCoef = 0.0015;
	rudderForceCoef = 14;
	rudderForceCoefAtMaxSpeed = 18;


	//----- Gearbox Parameters -----//	
	class complexGearbox
	{
		GearboxRatios[] = {"R1",-0.782,"N",0,"D1",1.3,"D2",1.15,"D3",0.8}; 
		TransmissionRatios[] = {"High", 1.0};
		gearBoxMode = "auto";
		moveOffGear = 1;
		driveString = "D";
		neutralString = "N";
		reverseString = "R";
	};


	//----- Engine Parameters -----//		
	torqueCurve[] = {
	{0 , 0},
	{0.14 , 0.74},
	{0.29 , 0.88},
	{0.43 , 1},
	{0.57 , 1},
	{0.71 , 0.94},
	{0.86 , 0.86},
	{1 , 0.77},
	};
	maxOmega = 408,41;
	enginePower = 3408;
	peakTorque = 6800;

	idleRpm = 200;
	redRpm = 1200;		
	engineShiftY = -10.100;
	thrustDelay = 2.5;	



	enableManualFire = 0;
	smokeLauncherGrenadeCount = 20;
	smokeLauncherVelocity = 14;
	smokeLauncherOnTurret = 0;
	smokeLauncherAngle = 180;
	magazines[] = {"60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine","60Rnd_CMFlare_Chaff_Magazine"};
	weapons[] = {"CMFlareLauncher"};

	/*class Exhausts
	{
		class Exhaust1
		{
			position = "Exhaust1";
			direction = "Exhaust1_dir";
			effect = "DamageSmokePlane";
		};
	};*/

	memoryPointsLeftWaterEffect = "waterEffectL";
	memoryPointsRightWaterEffect = "waterEffectR";
	leftFastWaterEffect = "LFastWaterEffects";
	rightFastWaterEffect = "RFastWaterEffects";
	waterEffectSpeed = 5;
	engineEffectSpeed = 5;
	waterFastEffectSpeed = 18;

	class Turrets : Turrets
	{

	};

	extCameraPosition[] = {0, 30, -70.0};

	class Reflectors
	{
		class Left
		{
			color[] = {1.0, 1.0, 1.0, 1.0};
			ambient[] = {0.2, 0.2, 0.2, 1.0};
			position = "light_left";
			direction = "light_left_dir";
			hitpoint = "light_left";
			selection = "light_left";
			size = 0.5;
			brightness = 0.6;
		};
	};

	aggregateReflectors[] = {{"Left"}};

	//hiddenSelections[] = {"Camo", "Camo2", "Camo3"};
};
};

I used some code parts from the speedboat-refinement in my mod.

Should work, but it isn't. So my guess is, that's something with the model. It seems like it sits on top of the water surface, and not directly in the water. Could be the problem....

Share this post


Link to post
Share on other sites

Is your displacement LOD setup?

Edited by ProGamer

Share this post


Link to post
Share on other sites
What is a displacement LOD?

Ensure that the geometry is accurate to the shape of the ship, with accurate mass distribution and realistic Center of Mass.

Create a simplified copy of the geometry, for use in the displacement LOD.

The displacement LOD should adhere to these rules:

Have as few faces as possible - high face counts will have a negative impact on performance.

Convex components must not penetrate each other if possible (especially on permanently immersed parts). If they penetrate, then their volume and surface is calculated twice.

Convex components must not even touch each other. Merge them together if possible. (especially on permanently immersed parts). If they touch, then their surface is calculated twice. This is not that big a problem on not permanently immersed parts.

Inside areas must not be modeled. Volume is not calculated for this area and inside surface is then added, which we do not want.

Volume of the object represents what will generate buoyancy. Do not model parts which can instantly fill with the water.

Surface of the object represents what will generate resistance in water. Create only one convex component for permanently immersed part.

The ideal displacement LOD is built of a single component which matches (approximately) the shape of the hull. It is important that the volume be reasonably close to the real volume of the ship, as this is used for buoyancy calculations.

The displacement LOD adheres to the normal rules for geometry LODs.

Share this post


Link to post
Share on other sites

Where can I find the displacement LOD? I mean if I create a new LOD and click "Properties" I don't find something called "displacement"

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×