File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " ecctrl" ,
3
- "version" : " 1.0.38 " ,
3
+ "version" : " 1.0.39 " ,
4
4
"author" : " Erdong Chen" ,
5
5
"license" : " MIT" ,
6
6
"description" : " A floating rigibody character controller for R3F" ,
Original file line number Diff line number Diff line change @@ -122,12 +122,14 @@ EcctrlProps: {
122
122
capsuleRadius: 0.3 , // Radius of the character capsule
123
123
floatHeight: 0.3 , // Height of the character when floating
124
124
characterInitDir: 0 , // Character initial facing direction (in rad)
125
- followLight: false , // Enable follow light mode
125
+ followLight: false , // Enable follow light mode (name your light "followLight" before turn this on)
126
126
// Follow camera setups
127
127
camInitDis: - 5 , // Initial camera distance
128
128
camMaxDis: - 7 , // Maximum camera distance
129
129
camMinDis: - 0.7 , // Minimum camera distance
130
130
camInitDir: 0 , // Camera initial position direction (in rad)
131
+ // Follow light setups
132
+ followLightPos: { x: 20 , y: 30 , z: 10 }, // Follow light position
131
133
// Base control setups
132
134
maxVelLimit: 2.5 , // Maximum velocity limit
133
135
turnVelMultiplier: 0.2 , // Turn velocity multiplier
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ const Ecctrl = forwardRef<RapierRigidBody, EcctrlProps>(({
34
34
camMaxDis = - 7 ,
35
35
camMinDis = - 0.7 ,
36
36
camInitDir = 0 , // in rad
37
+ // Follow light setups
38
+ followLightPos = { x : 20 , y : 30 , z : 10 } ,
37
39
// Base control setups
38
40
maxVelLimit = 2.5 ,
39
41
turnVelMultiplier = 0.2 ,
@@ -696,9 +698,9 @@ const Ecctrl = forwardRef<RapierRigidBody, EcctrlProps>(({
696
698
* Apply character position to directional light
697
699
*/
698
700
if ( followLight && dirLight ) {
699
- dirLight . position . x = currentPos . x + 20 ;
700
- dirLight . position . y = currentPos . y + 30 ;
701
- dirLight . position . z = currentPos . z + 10 ;
701
+ dirLight . position . x = currentPos . x + followLightPos . x ;
702
+ dirLight . position . y = currentPos . y + followLightPos . y ;
703
+ dirLight . position . z = currentPos . z + followLightPos . z ;
702
704
dirLight . target = characterModelRef . current ;
703
705
}
704
706
@@ -1076,6 +1078,8 @@ export interface EcctrlProps extends RigidBodyProps {
1076
1078
camMaxDis ?: number ;
1077
1079
camMinDis ?: number ;
1078
1080
camInitDir ?: number ;
1081
+ // Follow light setups
1082
+ followLightPos ?: { x : number , y : number , z : number } ,
1079
1083
// Base control setups
1080
1084
maxVelLimit ?: number ;
1081
1085
turnVelMultiplier ?: number ;
You can’t perform that action at this time.
0 commit comments