Jump to content
  • Advertisement

Agustin Andreucci

  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About Agustin Andreucci

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Agustin Andreucci

    Align sight to camera

    I made it work. With the more mainstream approaches, we would require quite a bit of tweaking and since we are a very small team we can't afford it. The math I posted was correct except for the part in which I set the location and rotation of the Mesh1P to counter the socket's transform. This way I can use less than ideal animation poses and always have the weapon centered. Thank you very much for your help and taking time to help me out!
  2. Agustin Andreucci

    Align sight to camera

    I have the "IronSights" pose, but I would have to modify every pose to match the center of the screen. Right now the poses I have are close but slightly rotated and translated. What I'm trying to do is offset the arms root bone and rotate it in such a way that I end up with the sights centered while not modifying the pose.
  3. Agustin Andreucci

    Align sight to camera

    Socket rotation is in parent bone space. It has to be converted so it can be applied to the first person arms mesh. I'm not moving the camera but the arms. If I moved the camera, any roll the gun could have should be applied inversely to the camera which would have a weird effect on the camera since everything will appear a little bit rolled.
  4. Agustin Andreucci

    Align sight to camera

    The Offset is obtained and it matches perfectly. Rotation is being problematic. I can't seem to find the correct rotation quaternion.
  5. Agustin Andreucci

    Align sight to camera

    Hi @Scouting Ninja, thanks for the answer. I know how to interpolate it to the position, problem is that position is not matching. This is where I want the camera to end up relative to the weapon. This is where it is actually ending up relative to the root bone: Positioning is right, it is rotation that is bugging me.
  6. Agustin Andreucci

    Align sight to camera

    Hi everyone,I got stuck with my approach to aiming down sights. I've set up my first person arms mesh to be a child of the camera. Added a socket on the right hand of the skeleton to which I attach my weapon and there is a socket in the weapon used to signal the point at which the camera should sit during aiming down sight. When the players aims holding left click what I'm trying to do is to calculate the offset of the sight socket to the root of the FPP Mesh while on the aiming down sights pose and move the camera based on that. I'm using the code attached below. It's Unreal Engine but the problem seemed generic enough to qualify as an algebra one. What I'm doing is obtaining the transformations from the camera to the sight bone. That gives me the sight transform relative to the camera. After that I just negate the translation vector and add it to the first child of the camera. I was expecting to have the sight bone sit at the exact same point as the camera. What happens is that it is almost there but it's not correctly aligned. I believe my math and the general idea is right. Any ideas why this could be failing? Here is how I apply the resulting transform and below how I obtain it. Thank you very much for reading. FVector Translation = DeltaTransform.GetTranslation(); Translation.Z = 165.0f; /*Translation.X += Translation.Y; Translation.Y = Translation.X - Translation.Y; Translation.X = Translation.X - Translation.Y;*/ DeltaTransform *= DefaultMesh1PTransform; DeltaTransform.SetTranslation(Translation); Mesh1PCamOffsetLocationDelta = DeltaTransform.GetTranslation(); Mesh1PCamOffsetRotationDelta = DeltaTransform.GetRotation(); bInterpMesh1PCamOffset = bInterp; UE_LOG(LogTemp, Warning, TEXT("DeltaInverse Location x: %f, y: %f, z: %f"), (DeltaTransform).GetLocation().X, (DeltaTransform).GetLocation().Y, (DeltaTransform).GetLocation().Z); Mesh1P->SetRelativeLocation(DeltaTransform.GetLocation() * -1); UE_LOG(LogTemp, Warning, TEXT("Rotation yaw: %f, pitch: %f, roll: %f"), DeltaTransform.GetRotation().Rotator().Yaw, DeltaTransform.GetRotation().Rotator().Pitch, DeltaTransform.GetRotation().Rotator().Roll); FTransform HandToComponent; HandToComponent.SetIdentity(); FTransform BoneTransform; USkeletalMeshComponent* Mesh1P = CarryingPlayer->Mesh1P; // Get transform to weapon attach socket space HandToComponent *= FirearmMesh->GetSocketTransform(FName("sight_point_socket"), RTS_ParentBoneSpace); HandToComponent *= Mesh1P->GetSocketTransform(Firearm->GetCarrySocket(), RTS_ParentBoneSpace); // Get transform from the right hand bone relative to component (root bone) FName CurrentBoneName = FName("hand_r"); while (CurrentBoneName != NAME_None) { ArmsADSIdleAnimSequence->GetBoneTransform(BoneTransform, Mesh1P->GetBoneIndex(CurrentBoneName), 0.0f, true); HandToComponent *= BoneTransform; CurrentBoneName = Mesh1P->GetParentBone(CurrentBoneName); } return HandToComponent;
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!