[Tutorial] How to Interact with objects through the wall

Results 1 to 1 of 1
  1. #1
    Enthusiast darkwiings is offline
    MemberRank
    Jun 2014 Join Date
    BrasilLocation
    33Posts

    shout [Tutorial] How to Interact with objects through the wall

    Hello!


    I know a lot of people that prefer that items can be picked up through the wall. Me for example haha.


    Well, let's go. It's super simple.

    In AI_Player.cpp search for:
    Code:
                if(distance > d)            {
                    // check dist to player
                    if((objCenter - GetPosition()).LengthSq() > (maxDist*maxDist))
                        continue;
                    // check if both player and camera are facing object
                    if((GetPosition()-objCenter).Dot(gCam-objCenter) < 0.0f) 
                        continue;
                    // check ray cast that you can see that item
                    bool isVisible = false;
                    r3dVector objSizeBBox = obj->GetBBoxWorld().Size/4;
                    r3dVector posToTest[5] = {objCenter,objCenter+r3dVector(-objSizeBBox.x,    objSizeBBox.y, -objSizeBBox.z),
                                                        objCenter+r3dVector( objSizeBBox.x,    objSizeBBox.y, -objSizeBBox.z),
                                                        objCenter+r3dVector(-objSizeBBox.x,    objSizeBBox.y,  objSizeBBox.z),
                                                        objCenter+r3dVector( objSizeBBox.x,    objSizeBBox.y,  objSizeBBox.z) };

    Replace the red text for
    Code:
    bool isVisible = true;
    Compile and be happy!

    If i help you, rep+

    Sorry bad english.




Advertisement