- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- [SOLVED] Is it possible rotate sim programmatically?
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- [SOLVED] Is it possible rotate sim programmatically?
Replies: 3 (Who?), Viewed: 1819 times.
#1
4th Nov 2014 at 1:19 PM
Last edited by ArtUrlWWW : 4th Nov 2014 at 2:20 PM.
Posts: 133
Thanks: 1494 in 13 Posts
[SOLVED] Is it possible rotate sim programmatically?
Hi.I need to rotate sim. For example, I have animation, where female sim rotated 90 degrees counterclockwise and male sim rotated 90 degrees clockwise:
I use code to play animation with jazz file:
C# code:
Code:
using Sims3.Gameplay; using Sims3.Gameplay.Abstracts; using Sims3.Gameplay.Actors; using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.Autonomy; using Sims3.Gameplay.Core; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Interfaces; using Sims3.Gameplay.ObjectComponents; using Sims3.Gameplay.Objects.Decorations; using Sims3.Gameplay.Routing; using Sims3.SimIFace; using Sims3.UI; using System; using System.Collections.Generic; using System.Text; namespace YourNameSpaceHere { internal sealed class GoToSim7 : Interaction<Sim, Sim> { public static readonly InteractionDefinition Singleton = new Definition(); protected override bool Run() { if (!base.Actor.RouteToObjectRadialRange(base.Target, 0, 5)) { return false; } MyFirstAnimFunction(); return true; } [DoesntRequireTuning] private sealed class Definition : InteractionDefinition<Sim, Sim, YourNameSpaceHere.GoToSim7> { protected override string GetInteractionName(Sim a, Sim target, InteractionObjectPair interaction) { return "GoToSim1+"; } protected override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { // if (a == target) return false; return true; } } public void MyFirstAnimFunction() { this.Actor.ShowTNSIfSelectable("!!! STARTING ANIMATION !!!", StyledNotification.NotificationStyle.kSimTalking); Sim actor = this.Actor; // Must be male actor! Sim target = this.Target; // Must be female actor! actor.LookAtManager.DisableLookAts(); target.LookAtManager.DisableLookAts(); StateMachineClient stateMachineClient = StateMachineClient.Acquire(actor, "a_han_tests_test2"); stateMachineClient.SetActor("x", actor); stateMachineClient.SetActor("y", target); if (actor.SimDescription.Gender == target.SimDescription.Gender) { stateMachineClient.SetParameter("x:Gender", "M"); stateMachineClient.SetParameter("y:Gender", "F"); } else { stateMachineClient.SetParameter("x:Gender", actor.IsMale ? "M" : "F"); stateMachineClient.SetParameter("y:Gender", target.IsMale ? "M" : "F"); } stateMachineClient.SetParameter("x:Age", actor.SimDescription.Teen ? "T" : "A"); stateMachineClient.SetParameter("y:Age", target.SimDescription.Teen ? "T" : "A"); stateMachineClient.SetParameter("root", "QQQ"); stateMachineClient.EnterState("x", "Enter"); actor.SynchronizationRole = Sim.SyncRole.Initiator; actor.SynchronizationTarget = target; actor.SynchronizationLevel = Sim.SyncLevel.Routed; if (!actor.WaitForSynchronizationLevelWithSim(target, Sim.SyncLevel.Routed, 60f)) { this.Actor.ShowTNSIfSelectable("!!! !WaitForSynchronizationLevelWithSim !!!", StyledNotification.NotificationStyle.kSimTalking); //return false; } this.Actor.ShowTNSIfSelectable("!!! STARTING ANIMATION - MyAnimPlay1 !!!", StyledNotification.NotificationStyle.kSimTalking); stateMachineClient.RequestState("x", "MyAnimPlay1"); this.Actor.ShowTNSIfSelectable("!!! END OF ANIMATION !!!", StyledNotification.NotificationStyle.kSimTalking); //return true; } } }
JAZZ code:
Code:
State Machine "a_han_tests_test2" { Actor "x" Actor "y" Parameter "root" = "root" Parameter "x:Gender" = "M" Parameter "y:Gender" = "F" Parameter "x:Age" = "A" Parameter "y:Age" = "A" Assign Actor "a_han_tests_test2.ma"."x" as "x" Assign Actor "a_han_tests_test2.ma"."y" as "y" State "Enter" { Properties Public, Entry Transitions to "MyAnimPlay1" } State "MyAnimPlay1" { Properties Public, Explicit Transitions to "Exit" Play "a_han_tests_test2_male" With Substitution for "x" { Blend In 0.00333334 } Play "a_han_tests_test2_female" With Substitution for "y" { Blend In 0.00333334 } } State "Exit" { Properties Public, Exit } }
As result sims positioned incorrect:
Step 1:
And step two - incorrect rotating:
I want rotate sims counterclockwise and clockwise programmatically before animation - for correct positioning "face to face". How to rotate sims programmatically?
Thank you.
Advertisement
#2
4th Nov 2014 at 2:20 PM
Posts: 133
Thanks: 1494 in 13 Posts
I love this game API !!!
It's solved very simple:
It's solved very simple:
Code:
Actor.SetRotation(90);
#3
10th Nov 2014 at 10:39 AM
Posts: 997
Thanks: 22102 in 95 Posts
You should rotate the sim/model/mesh with blender, not with the code.
If a sim is facing north before the animation starts then he should still face
north when playing the animation, otherwise it means that the sim/mesh
has the wrong orientation in the animation.
I hope I have explained that clearly and understandably.
If a sim is facing north before the animation starts then he should still face
north when playing the animation, otherwise it means that the sim/mesh
has the wrong orientation in the animation.
I hope I have explained that clearly and understandably.
#4
12th Nov 2014 at 4:47 PM
Posts: 133
Thanks: 1494 in 13 Posts
I've been trying to find a position with a code. Then it has bothered me and I changed the positioning of objects in Blender.
Who Posted
|