[Free Licence compatible][English+Russian]How to use customs collision groups


Go to page Previous  1, 2, 3

Users browsing this forum: No registered users and 1 guest

Next topic
Previous topic
Post new topic Reply to topic  NeoAxis Forum Index » Additional » Tutorials and Articles from Community
Search for:
Author Message

Joined: Sun Jul 03, 2016
Posts: 13
PostPosted: Wed Oct 05, 2016 9:05 pm 
Reply with quote Bottom of Page Back to top
Eng.
For physically based hitboxes.

Rus.
Для хитбоксов, работающих на физике.

 
 Profile  

Joined: Thu Apr 14, 2011
Posts: 176
PostPosted: Thu Oct 06, 2016 2:04 pm 
Reply with quote Bottom of Page Back to top
Do not mean to hijack this post but here is the code Russian Batman might be looking for
Code: Select all   Expand view
                Ray ray = new Ray(startPosition, offset);
               
                RayCastResult[] piercingResult = PhysicsWorld.Instance.RayCastPiercing(
                    ray, (int)ContactGroup.CastOnlyContact);

                foreach (RayCastResult result in piercingResult)
                {
                    MapObject obj = MapSystemWorld.GetMapObjectByBody(result.Shape.Body);

                    string hitArea = result.Shape.Name;//Name of the armor plate hit.

                    float TargetArmor = Armor_Tables.Check_Armor_Tables(hitArea);//Find thickness of armor.
place this in Bullet inside onTick. hitArea will give you the name of the physics shape that was hit.

obj can be used to get the angle of the veihcle that was hit and such.

I have a lot of extra code in bullet and in other custom classes to check armor thickness and penatration of shell att different angles. Allso custom physic body for the charactor with head, body, arms, and legs as separet physics shapes, allowing percision hits on enemy. I have custom bullets that work with the system.

Here is some of the code to Armor_Tables class...
Code: Select all   Expand view
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.ComponentModel;
using System.Drawing.Design;
using Engine;
using Engine.Renderer;
using Engine.EntitySystem;
using Engine.MapSystem;
using Engine.MathEx;
using Engine.PhysicsSystem;
using ProjectCommon;
using System.Security.Cryptography;

namespace ProjectEntities
{
    public class Armor_Tables
    {
        //hitArea is the name of the physics shape that was hit, we
        //extract the tank name, the first seven letters and find its
        //armor thickness, the thickness is sent back.
        public static float Check_Armor_Tables(string hitArea)
        {
            float ArmorThickness = 0;
            if (hitArea.Length > 7)//Tank name must allways have 7 letters.
            {
                string TankName = hitArea.Substring(0, 7);

                if (TankName == "T34_40_")
                {
                    ArmorThickness = T34_40_(hitArea);
                }
                if (TankName == "PzKwIII")
                {
                    ArmorThickness = PzKwIII(hitArea);
                }
                if (TankName == "M3A1___")
                {
                    ArmorThickness = M3A1___(hitArea);
                }
                if (TankName == "M4A2___")
                {
                    ArmorThickness = M4A2___(hitArea);
                }
                if (TankName == "Stug___")
                {
                    ArmorThickness = Stug___(hitArea);
                }
                if (TankName == "PzKwIV_")
                {
                    ArmorThickness = PzKwIV_(hitArea);
                }
                if (TankName == "PzKwV__")
                {
                    ArmorThickness = PzKwV__(hitArea);
                }
                if (TankName == "Tiger2_")
                {
                    ArmorThickness = Tiger2_(hitArea);
                }
                if (TankName == "R35____")
                {
                    ArmorThickness = R35____(hitArea);
                }
                if (TankName == "Avatar_")
                {
                    ArmorThickness = Avatar_(hitArea);
                }
            }
            return ArmorThickness;
        }

        public static float T34_40_(string hitArea)
        {
            float ArmorThickness = 0;//Start clean
            //****The names here match the names of physical shapes in your models****
            if (hitArea == "T34_40_Front_Turret")
            { ArmorThickness = 55; }
            if (hitArea == "T34_40_Side_Turret")
            { ArmorThickness = 55; }
            if (hitArea == "T34_40_Rear_Turret")
            { ArmorThickness = 45; }
            if (hitArea == "T34_40_Turret_Top")
            { ArmorThickness = 18; }
            if (hitArea == "T34_40_Front_UH")
            { ArmorThickness = 74; }
            if (hitArea == "T34_40_Front_LH")
            { ArmorThickness = 60; }
            if (hitArea == "T34_40_Side_UH")
            { ArmorThickness = 74; }
            if (hitArea == "T34_40_Rear_Hull")
            { ArmorThickness = 74; }
            if (hitArea == "T34_40_Body_Top")
            { ArmorThickness = 12; }
            return ArmorThickness;
        }

        public static float PzKwIII(string hitArea)
        {
            float ArmorThickness = 0;//Start clean
            //****The names here match the names of physical shapes in your models****
            if (hitArea == "PzKwIIIFront_Turret12")
            { ArmorThickness = 157; }
            if (hitArea == "PzKwIIISide_Turret11")
            { ArmorThickness = 36; }
            if (hitArea == "PzKwIIIRear_Turret11")
            { ArmorThickness = 36; }
            if (hitArea == "PzKwIIITop__Turret90")
            { ArmorThickness = 18; }
            if (hitArea == "PzKwIIIFront_LH30")
            { ArmorThickness = 74; }
            if (hitArea == "PzKwIIIFront_UH30")
            { ArmorThickness = 55; }
            if (hitArea == "PzKwIIISide_UH00")
            { ArmorThickness = 30; }
            if (hitArea == "PzKwIIIRear_Hull00")
            { ArmorThickness = 53; }
            if (hitArea == "PzKwIIITop__90")
            { ArmorThickness = 30; }
            return ArmorThickness;
        }

        public static float Avatar_(string hitArea)
        {
            float ArmorThickness = 0;//Start clean
            if (hitArea == "Avatar_Head_00")
            { ArmorThickness = 5; }
            if (hitArea == "Avatar_Body_00")
            { ArmorThickness = 30; }
            if (hitArea == "Avatar_Legs_00")
            { ArmorThickness = 10; }
            if (hitArea == "Avatar_ArmRi00")
            { ArmorThickness = 10; }
            if (hitArea == "Avatar_ArmLe00")
            { ArmorThickness = 10; }
            return ArmorThickness;
        }
    }

}



If you would like the entire code to the persition bullet system I could do that in a separet post.
:)

 
 Profile  

Joined: Thu Feb 03, 2011
Posts: 1306
PostPosted: Fri Oct 07, 2016 4:14 pm 
Reply with quote Bottom of Page Back to top
RussianBatman wrote:
Eng.
How is it used and for what?

Rus.
Как и где это применять?


The code disable collision between "parent map Object" and "childrens MapObject"


@Pugly2 yeah, better have a separated post with explications ( you can still post the link here )

 
 Profile  

Joined: Fri Aug 26, 2016
Posts: 9
PostPosted: Mon Oct 10, 2016 5:15 pm 
Reply with quote Bottom of Page Back to top
Firefly, and how to disable one of the settings for a single character at a certain time? for example, to pass through the trees (temporarily).

 
 Profile  

Joined: Fri Oct 07, 2016
Posts: 1
PostPosted: Mon Oct 10, 2016 7:50 pm 
Reply with quote Bottom of Page Back to top
Code: Select all   Expand view
Shape shape1, shape2;
PhysicsWorld.Instance.SetShapePairFlags( shape1, shape2, ShapePairFlags.DisableContacts );

 
 Profile  

Joined: Fri Aug 26, 2016
Posts: 9
PostPosted: Tue Oct 11, 2016 3:34 pm 
Reply with quote Bottom of Page Back to top
No. Method disables the collision of bodies in one of the same physics. I need to disable collisions (e.g. trees) for the character, he should just get in contact with other objects.
Like this, but not for peace, but only for a single character.

Code: Select all   Expand view
PhysicsWorld.Instance.SetupContactGroups( (int)ContactGroup.Dynamic, (int)ContactGroup.Collision, false);

 
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  NeoAxis Forum Index » Additional » Tutorials and Articles from Community
Go to page Previous  1, 2, 3

Jump to:  

Next topic
Previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron

All times are UTC




Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group