I need to download rules that represent sports fields

2683
13
10-01-2019 08:57 AM
nadiatrigui
New Contributor II

I am creating a 3D city, I need to model sports fields (football, tennis, Golf course pisscine ....) I can not find the rules to represent these types of sports equipment, I used the SOCCER FIELD rule in the DESERT CITY package, but it only contains soccer fields. Can you help me please.

0 Kudos
13 Replies
nadiatrigui
New Contributor II

I have the same problem

0 Kudos
Luiz_AmadeuCoutinho
Occasional Contributor III

Hi

Why not create your own rule?

The Desert_City_Soccerfield.cga it´s it´s a basic rule that use one .jpg to show the Field, one .obj to show Goals and another to show Balls. 

Try copy the rule and change the assets to your data. Search on Google for tennis field textures or Golf Course, you will find a lot of samples. 🙂 

/**
* Author: matt, Esri R&D Center Zurich
*/

version "2013.1"

attr Orientation_Change = false
attr Goal_Back_Distance = 1.8
attr Goal_Width = 6
attr Goal_Height = 2
attr Goal_Depth = 2
attr Number_Balls = 7


// put your assets on assets Folder e change the file names 

soccerFieldTex = "assets/soccerField/soccerField.jpg"
goalAsset = "assets/soccerField/soccerGoal.obj"
esriBall = "assets/soccerField/esriBall.obj"


goalEdgeID =
case Orientation_Change :
1
else :
0
UV_Rotation =
case Orientation_Change :
0
else :
90

@StartRule
SoccerField -->
Goals
Balls
setupProjection(0, scope.xz, '1,'1)
projectUV(0)
rotateUV(0,UV_Rotation)
texture(soccerFieldTex)
Field.

Goals -->
PutGoal(goalEdgeID)
PutGoal(goalEdgeID + 2)

PutGoal(edgeIndex) -->
alignScopeToGeometry(yUp, 0, edgeIndex)
split(z) {Goal_Back_Distance : NIL | 0.05 : GoalStripe | ~1 : NIL}

GoalStripe -->
s(Goal_Width, Goal_Height, Goal_Depth)
center(x)
i(goalAsset)
Goal.

Balls -->
scatter(surface,Number_Balls,uniform) { PutBall }

PutBall -->
i(esriBall,yUp,keepSizeAndPosition)
t(0,'0.5,0)
r(scopeCenter, rand(360), rand(360), rand(360))
Ball.

nadiatrigui
New Contributor II

Hi

Thanks for your respone. I Did what you describe. I tried to change files and keep same names to not be obliged to change the rules code and this is the result

0 Kudos
nadiatrigui
New Contributor II

thanks so much Luiz Amadeu Coutinho , finally it works

0 Kudos
Luiz_AmadeuCoutinho
Occasional Contributor III

Good to know

Here a CGA for tennis field using a Collada File from 3D Warehouse. It´s another simple solution.

/**
* Author: ..., ...
*/
//change de CE Version here
version "2019.1"

attr Orientation_Change = false

tennisFieldTex1 = "assets/tennis_court/model.dae"

UV_Rotation =
case Orientation_Change :
0
else :
90

@StartRule
TennisCourt -->

setupProjection(0, scope.xz, 0,0)
projectUV(0)
rotateUV(0,UV_Rotation)
//alignScopeToGeometry(yUp,90,0)
alignScopeToGeometry (yUp, any, world.lowest)
i(tennisFieldTex1)
Field.

0 Kudos
TH1
by
New Contributor II

Hi Luiz Amadeu Coutinho,

i have the problem, that the Soccer field (a model out of the 3D Warehouse) isn't right displayed.

The Orientation_Change doesn't work.

I used the following code:

attr Orientation_Change = false

soccerFieldTex1 = "assets/Sport/Fussball.dae"

UV_Rotation =
case Orientation_Change :
0
else :
90

@StartRule

Soccerfield -->


setupProjection(0, scope.xz, 0,0)
projectUV(0)
rotateUV(0,UV_Rotation)
alignScopeToGeometry (yUp, any, world.lowest)
i(soccerFieldTex1)

and it looks always like this:

Is there an option to turn the soccerfield.dae?

Thank you .

0 Kudos
Luiz_AmadeuCoutinho
Occasional Contributor III

Hi TH

Comment using // in the front of

alignScopeToGeometry (yUp, any, world.lowest)

And try again. 

 

Here more info and options alignScopeToGeometry operation—CGA | Documentation  

0 Kudos
TH1
by
New Contributor II

Hi Luiz,

thank you for the reply.

I finally got it. I had to change the Edge Index.

Soccerfield -->

setupProjection(0, scope.xy, 0,0)
projectUV(0)
rotateUV(0,UV_Rotation)
alignScopeToGeometry (yUp, 0,1)
i(soccerFieldTex1)

0 Kudos
Javier_JovannyLeija
New Contributor II

Hello Luiz,

I was able to reproduce the field, but couldn't get the ball or the goals to come out in the image. They still are unknown objects.

Here is the code I used.

/**
* File: Soccerfield.cga
* Created: 19 Apr 2020 06:11:42 GMT
* Author: javii
*/

version "2019.1"
attr Orientation_Change = false
attr Goal_Back_Distance = 1.8
attr Goal_Width = 6
attr Goal_Height = 2
attr Goal_Depth = 2
attr Number_Balls = 1
soccerFieldTex = "assets/soccerField/soccerField.jpg"
goalAsset = "assets/soccerField/soccerGoal.obj"
esriBall = "assets/soccerField/esriBall.obj"


goalEdgeID =
case Orientation_Change :
1
else :
0
UV_Rotation =
case Orientation_Change :
0
else :
90

@StartRule
SoccerField -->
Goals
Balls
setupProjection(0, scope.xz, '1,'1)
projectUV(0)
rotateUV(0,UV_Rotation)
texture(soccerFieldTex)
Field.

Goals -->
PutGoal(goalEdgeID)
PutGoal(goalEdgeID + 2)

PutGoal(edgeIndex) -->
alignScopeToGeometry(yUp, 0, edgeIndex)
split(z) {Goal_Back_Distance : NIL | 0.05 : GoalStripe | ~1 : NIL}

GoalStripe -->
s(Goal_Width, Goal_Height, Goal_Depth)
center(x)
i(goalAsset)
Goal.

Balls -->
scatter(surface,Number_Balls,uniform) { PutBall }

PutBall -->
i(esriBall,yUp,keepSizeAndPosition)
t(0,'0.5,0)
r(scopeCenter, rand(360), rand(360), rand(360))
Ball.

0 Kudos