public static unsafe Vector3 GetBoneOriginalTranslation(Vehicle vehicle, int index) { CVehicle * veh = (CVehicle *)vehicle.MemoryAddress; NativeVector3 v = veh->inst->archetype->skeleton->skeletonData->bones[index].translation; return(v); }
public static unsafe Quaternion GetBoneOriginalRotation(Vehicle vehicle, int index) { CVehicle * veh = (CVehicle *)vehicle.MemoryAddress; NativeVector4 v = veh->inst->archetype->skeleton->skeletonData->bones[index].rotation; return(v); }
public static Quaternion GetBoneOriginalRotation(Vehicle vehicle, int index) { CVehicle * veh = (CVehicle *)vehicle.MemoryAddress; NativeVector4 v = veh->Inst->CacheEntry->Skeleton->Data->Bones[index].Rotation; return(v); }
public static Vector3 GetBoneOriginalTranslation(Vehicle vehicle, int index) { CVehicle * veh = (CVehicle *)vehicle.MemoryAddress; NativeVector3 v = veh->Inst->CacheEntry->Skeleton->Data->Bones[index].Translation; return(v); }
public static unsafe Quaternion GetBoneOriginalRotation(Vehicle vehicle, int index) { CVehicle * veh = (CVehicle *)vehicle.MemoryAddress; Quaternion q = veh->inst->entry->skeleton->skeletonData->bones[index].rotation; return(q); }
/// <summary> /// Gets the original rotation of the bone with <paramref name="index"/> in <paramref name="vehicle"/>. /// </summary> /// <param name="vehicle">Instance of a <see cref="Vehicle"/>.</param> /// <param name="index">Bone's index.</param> /// <returns><see cref="Vector3"/> rotation of the bone.</returns> public static Quaternion GetBoneOriginalRotation(this Vehicle vehicle, int index) { if (!vehicle.NotNullAndExists()) { return(Quaternion.Zero); } unsafe { CVehicle * veh = (CVehicle *)vehicle.MemoryAddress; NativeVector4 v = veh->inst->archetype->skeleton->skeletonData->bones[index].rotation; return(v); } }
public HideablePart(Vehicle vehicle, VehicleGadgetEntry dataEntry) : base(vehicle, dataEntry) { hideablePartDataEntry = (HideablePartEntry)dataEntry; if (!VehicleBone.TryGetForVehicle(vehicle, hideablePartDataEntry.BoneName, out bone)) { throw new InvalidOperationException($"The model \"{vehicle.Model.Name}\" doesn't have the bone \"{hideablePartDataEntry.BoneName}\" for the {HideablePartEntry.XmlName}"); } conditions = Conditions.GetConditionsFromString(vehicle.Model, hideablePartDataEntry.Conditions); nativeVeh = (CVehicle *)vehicle.MemoryAddress; boundIndex = GameFunctions.fragInst_GetBoundIndexForBone(nativeVeh->Inst, bone.Index); hasBound = boundIndex != -1; }
public static unsafe int GetBoneIndex(Vehicle vehicle, string boneName) { if (vehicle == null) { return(-1); } CVehicle * veh = (CVehicle *)vehicle.MemoryAddress; crSkeletonData *skelData = veh->inst->archetype->skeleton->skeletonData; uint boneCount = skelData->bonesCount; for (uint i = 0; i < boneCount; i++) { if (skelData->GetBoneNameForIndex(i) == boneName) { return(unchecked ((int)i)); } } return(-1); }
// unlike the native/RPH's method, this one works with bones with custom names, // for example for a bone named "ladder_base", the native will return -1 but // this method will return the proper index. public static int GetBoneIndex(Vehicle vehicle, string boneName) { if (!vehicle) { throw new InvalidHandleableException(vehicle); } CVehicle * veh = (CVehicle *)vehicle.MemoryAddress; crSkeletonData *skelData = veh->inst->archetype->skeleton->skeletonData; uint boneCount = skelData->bonesCount; for (uint i = 0; i < boneCount; i++) { if (skelData->GetBoneNameForIndex(i) == boneName) { return(unchecked ((int)i)); } } return(-1); }
/// <summary> /// Returns index of <paramref name="bone"/> in <paramref name="vehicle"/>. /// </summary> /// <param name="vehicle">Instance of a <see cref="Vehicle"/>.</param> /// <param name="bone">Name of the bone.</param> /// <returns>Bone's index.</returns> public static int GetBoneIndex(this Vehicle vehicle, string bone) { if (!vehicle.NotNullAndExists()) { return(-1); } unsafe { CVehicle * veh = (CVehicle *)vehicle.MemoryAddress; CrSkeletonData *skelData = veh->inst->archetype->skeleton->skeletonData; uint boneCount = skelData->bonesCount; for (uint i = 0; i < boneCount; i++) { if (skelData->GetBoneNameForIndex(i) == bone) { return(unchecked ((int)i)); } } } return(-1); }
private static void Main() { while (Game.IsLoading) { GameFiber.Sleep(1000); } bool gameFnInit = GameFunctions.Init(); if (gameFnInit) { Game.LogTrivialDebug($"Successful {nameof(GameFunctions)} init"); } else { Game.LogTrivial($"[ERROR] Failed to initialize {nameof(GameFunctions)}, unloading..."); Game.UnloadActivePlugin(); } LoadVehicleConfigs(); while (true) { GameFiber.Yield(); if (Game.IsPaused) { continue; } Vehicle playerVeh = Game.LocalPlayer.Character.CurrentVehicle; if (playerVeh && !vehiclesChecked.Contains(playerVeh.Handle)) { CreateGadgetsForVehicle(playerVeh); } for (int i = gadgets.Count - 1; i >= 0; i--) { VehicleGadget g = gadgets[i]; if (g.Vehicle) { g.Update(g.Vehicle == playerVeh); if (g.RequiresPoseBounds) { vehiclesRequiringPoseBounds.Add(g.Vehicle); } } else { if (vehiclesChecked.Contains(g.Vehicle.Handle)) { vehiclesChecked.Remove(g.Vehicle.Handle); } g.Dispose(); gadgets.RemoveAt(i); } } foreach (Vehicle v in vehiclesRequiringPoseBounds) { CVehicle * cveh = (CVehicle *)v.MemoryAddress; fragInstGta *inst = cveh->Inst; if (inst == null) { return; } GameFunctions.fragInst_PoseBoundsFromSkeleton(inst, true, true, true, 0, 0); } vehiclesRequiringPoseBounds.Clear(); } }